Hello,

after reading the Database API 
thread<https://groups.google.com/forum/#!topic/nodejs/9a15xYx28Yc>, 
I was wondering if there was any interest in building a set of default 
interfaces for node packages. The most compelling advantages:

   - *Libraries are interchangeable*: You can use a file-based database 
   while developing (eg. SQLite) and switch to another solution (with more 
   space, better performance etc.) by changing a single require statement.
   - *Libraries only need to implement a subset of functionality*: Escaping 
   SQL queries is a common task for SQL libraries. This could be done by the 
   interface package, so that any implementing package only needs to provide a 
   function for running raw SQL statements (with a well-known name). When the 
   database has a more efficient way of performing a task, the library can 
   simply overwrite the provided functions.

This is not limited to databases: Another cool area would be file-access. A 
single interface providing a couple of asynchronous methods could be used 
to not only access the local file-system, but also FTP & WebDAV servers, 
Dropbox, iCloud & GDrive accounts and even Bittorrent files.

Someone implementing a module for syncing files could rely on that 
interface and allow users to simply throw in two instances of the interface 
and do it's job without caring about any underlying architecture. The 
interface would abstract eg. watching for changes.

Of course, the library can add special behavior for more efficient 
transfers (eg. between FTP servers using 
FXP<http://en.wikipedia.org/wiki/File_eXchange_Protocol>), 
but that's only optional.

I imagine interfaces to be similar to ES6's proxies: Functions that aren't 
provided directly are provided using the other functions, as long as that's 
possible. Besides, they can use util.inherits (or, for CS users, the 
extendskeyword), so that they can be implemented by adding a dependency and 
inheriting from it.

Of course, this concept needs to be promoted and I'm definitely not the 
right guy for that task (living in Germany, using node only for fun, never 
attended a conference etc.), but I would love to work on some of the 
default interfaces (especially the two mentioned above).

Any thoughts?

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to