Friday, October 25, 2013

The Best PhoneGap Architecture - (1)

It's not because it's written by our team, but I do think it is the best I ever work with after trying so many other architectures. Here "other architectures" mean the ones based on libs or frameworks or combine like jQueryMobile, KendoUI, SenchaTouch, AngularJS, BackBone, etc.
Let me show you why it’s the best:

1. Highly Readable Code

A good architecture MUST create clear file structure. The files must be organized very well to keep the code highly readable, which means:
  1. No file have more than 300 lines of code, normally less than 200;
  2. No folder have more than 30 files.
See below screenshot.
How does it look? I believe it looks very clear. All html pages are put into folder “pages”. All project-related javascripts are put into “scripts/at”, and there a few layers to group the JS files. You can easily get to know where to create new files or folders under this architecture.
How this structure can be done? Please read the next section: APP Starts And Index.html

No comments:

Post a Comment