The application structure
JavaScript doesn't impose much structure when it comes to file location and how the files are grouped. Titanium is no exception to this rule as the only things it imposes are that the files must be contained in the Resources
directory, and that app.js
is the first file that is executed.
But that doesn't mean we can't structure our files as a good practice. There are various approaches we can follow, and all share some good qualities. For this project (and some other ones later in this book), we will use this very simple directory structure for all our code under the Resource
directory:
Directory |
Contents |
---|---|
|
Models that will act as a representation of real-life objects that will be used in our application. |
|
Code that provides access to different services (database, device storage, communication, geolocation, and so on). |
|
All of our user interface components, whether they are reusable controls or entire windows. |
As this is a fairly more...