= EdenMobile Concepts = [[TOC]] == For Sahana Eden Developers == Apart from not being written in Python, there are a few key differences to Sahana Eden: === No Request Cycle === While Sahana Eden works in cycles of request=>response, EdenMobile is not cyclic in any way. Instead, the fundamental principle of the app is to respond to events, introspecting and updating the state (stateful application). === Thinking Asynchronous === The most confusing part for developers coming from the Sahana Eden web application may be the inescapable asynchronism in EdenMobile. Events can occur at any time and independently of each other - so many state changes can happen in parallel. Introspecting state and carefully maintaining scope are thus key requirements for any EdenMobile functionality. At the same time, all access to back-end resources is asynchronous as well - so the return of control to the caller (=the user, eventually) always comes first (i.e. before the response), and flow control, in the vast majority of cases, requires management of deferred objects and callback chains. === No Models? === Data models (table schemas and settings) in EdenMobile are not executable code, but data objects. They are stored in the database, and can be added (or modified) at run time. That requires all data processing to be introspective, and not relying on specific entity attributes (i.e. except for generic system- and meta-attributes that are common for all database resources). Consequently, there are no model-specific controllers/views in EdenMobile either. === Where are the widgets? === The Sahana Eden server application often produces HTML (and !JavaScript) and injects it into the view. Most prominent examples are forms and form widgets. EdenMobile implements AngularJS directives for this purpose. [wiki:DeveloperGuidelines/EdenMobile/Directives Directives] are basically custom HTML elements linked to !JavaScript functions which are called when the respective elements are rendered, and which can then modify the HTML elements dynamically (i.e. expand/replace them, and/or respond to events on those elements etc.).