camposer edited this page Aug 24, 2012 · 30 revisions

Documentation moved to camposer-alt.blogspot.com

I've been playing with Node.js for several days and started to ask myself how an application for real environments should be... This is how I got here, wanting to clarify common things/problems such as: i18n, MVC, DAO, SOA, REST, testing (xUnit style), documentation (Javadoc style), etc.

I hope this "conventions" (set of technologies and practices) help other programmers facing similar problems. I'm planning to add other examples including NoSQL and ORM, but right now only developed a simple app with Express as web framework and SQLite as SQL database engine. The app has CRUD operations for a user entity and was developed the way I think web apps should be programmed this days:

  • Presentation: HTML and CSS (inside CSS files). The HTML files should contain only static data and controls, NO format and NO logic.
  • Presentation logic: Javascript (inside JS files) and jQuery. jQuery Template for modifying presentation dynamically using HTML blocks. jQuery UI for improve user interface and effects.
  • Business logic interface: REST services. Presentation logic call REST services (using jQuery), which produces JSON data.
  • Business logic: Logic or service classes, separated from REST facades. This way your app can scale and be maintained easily. SOA style, decoupling!!!
  • Data logic: DAO classes. If you include an ORM, DAO should exist also for abstraction.

Following details for the sqlite example:

This should be put in other place...


  • UnitTesting. Not added so far, but I'm going to use QUnit. This is the unit testing tool used by jQuery.
  • ORM. Not added so far, but I'm going to use Node-ORM.

About Presentation

  • I used jQuery, jQuery Template (which is deprecated but still cannot find something better), and jQuery UI. @jesussjara recommend me to use Tempo instead of jQuery Template, I'll try it soon ;-)
  • The views are using styles from jQuery UI Theme Lightness. The jQuery UI CSS Framework. Comments on selectors...
  • Deploy. Using Capistrano... rodolfo@munra:$ sudo aptitude install rubygems1.9.1 rodolfo@munra:$ gem1.9.1 -v 1.3.7 rodolfo@munra:~$ gem1.9.1 install capistrano