Hi Sanjiva,

I implemented Caramel with Absolute.js but it seems that there is a higher
inefficiency - Back forth calls are happening in between Caramel and
Absolute.js. This is inefficient and it's not align with the main vision of
absolute.js which is simplicity. Since the Store and Publisher will have a
generic skeleton - using a framework similar to caramel will prove to be
highly efficient.

MVC

Before I list down the requirement for absolute I will include an except
regarding server side MVC (
http://addyosmani.github.io/backbone-fundamentals/#mvc-applied-to-the-web)
-

Other server-side implementations of MVC (such as the PHP
Zend<http://zend.com/> framework)
> also implement the Front 
> Controller<http://en.wikipedia.org/wiki/Front_Controller_pattern> design
> pattern. This pattern layers an MVC stack behind a single point of entry.
> This single point of entry means that all HTTP requests (e.g.,
> http://www.example.com, http://www.example.com/whichever-page/, etc.) are
> routed by the server’s configuration to the same handler, independent of
> the URI.
>


> When the Front Controller receives an HTTP request it analyzes it and
> decides which class (Controller) and method (Action) to invoke. The
> selected Controller Action takes over and interacts with the appropriate
> Model to fulfill the request. The Controller receives data back from the
> Model, loads an appropriate View, injects the Model data into it, and
> returns the response to the browser.
> For example, let’s say we have our blog on www.example.com and we want to
> edit an article (with id=43) and request
> http://www.example.com/article/edit/43:
>


> On the server side, the Front Controller would analyze the URL and invoke
> the Article Controller (corresponding to the/article/ part of the URI)
> and its Edit Action (corresponding to the /edit/ part of the URI). Within
> the Action there would be a call to, let’s say, the Articles Model and its
> Articles::getEntry(43) method (43 corresponding to the /43at the end of
> the URI). This would return the blog article data from the database for
> edit. The Article Controller would then load the (article/edit) View
> which would include logic for injecting the article’s data into a form
> suitable for editing its content, title, and other (meta) data. Finally,
> the resulting HTML response would be returned to the browser.
>


> As you can imagine, a similar flow is necessary with POST requests after
> we press a save button in a form. The POST action URI would look like
> /article/save/43. The request would go through the same Controller, but
> this time the Save Action would be invoked (due to the /save/ URI chunk),
> the Articles Model would save the edited article to the database with
> Articles::saveEntry(43), and the browser would be redirected to the
> /article/edit/43 URI for further editing.
>


> Finally, if the user requested http://www.example.com/ the Front
> Controller would invoke the default Controller and Action; e.g., the Index
> Controller and its Index action. Within Index Action there would be a call
> to the Articles model and its Articles::getLastEntries(10) method which
> would return the last 10 blog posts. The Controller would load the
> blog/index View which would have basic logic for listing the blog posts.


What absolute implements is the front end controller  based MVC pattern -
it brings clear cut architecture design for the controllers and views
(below is a diagram copied from the same source)

[image: webmvcflow_bacic.png]


Absolute.js follows the above architecture.

Modularization

It has also followed a modularized architecture as well. An example for
this would be APIs. We are using the
goose<https://github.com/dulichan/goose.js>module to handle APIs. If
we initialize

var router = new goose({CONTEXT: "/store/api/"});
var mvc = new absolute({
SERVER_URL:"/store/",
IGNORE:["sso.jag", "login.jag", "logout.jag"],
API:"api",
ROUTER: router
});

Now goose module will handle all requests that coming to the '/store/api'
route. An example would be -

router.get('users/current', function(ctx){
if(session.get("user")==null|| session.get("user")==undefined){
response.sendError(401);
return;
}
print (session.get('user'));
});

We are using Absolute.js in the MDM since it is very productive to use and
the architecture is much  cleaner.

Thanks.

PS:-

Please don't copy private lists .. my replies bounce when that's done! All
> technical people in WSO2 Mobile (um, which is everyone right now :-))
> should be reading this list too.


Noted :)

*Also to anyone interested in server side and client side mvc - read the
backbone book referred above. It gives a very good understanding of
javascript mvc. *

On Sat, Aug 3, 2013 at 8:45 PM, Sanjiva Weerawarana <[email protected]>wrote:

> IMO this is a *bad* decision.
>
> This will simply reduce the ability for one developer to contribute to
> both because we are being stubborn and refuse to use one framework. Can you
> please explain, succinctly, exactly what things that absolute.js does that
> caramel does not? I'm favoring caramel because it existed first and the
> second one is the one who has to explain why it was created. Otherwise its
> just NIH and we have no room for that because its an utter waste of time.
>
> Please don't copy private lists .. my replies bounce when that's done! All
> technical people in WSO2 Mobile (um, which is everyone right now :-))
> should be reading this list too.
>
>  Sanjiva.
>
>
> On Wed, Jul 31, 2013 at 9:31 PM, Chan <[email protected]> wrote:
>
>> Hi all,
>>
>> We have agreed on the architecture of the publisher and store for mobile.
>> We will be following the same caramel standard. We have forked the store
>> project and using it as the base for the publisher as well. The only
>> changes required for this implementation is regarding the presentation. API
>> will remain same until a generic publisher is built. After that we can
>> quickly switch the mobile publisher to the generic one since we have
>> followed the same pattern.
>>
>> Regarding absolute.js - we will be using it to build our MDM Console.
>> Since there is an overhead of using caramel and absolute together - we will
>> be decomposing caramel (extracting the helper functions) and adding them to
>> absolute.js. But the principal architecture will remain the same.
>>
>> Thanks.
>>
>>
>> On Tue, Jul 30, 2013 at 1:58 PM, Chan <[email protected]> wrote:
>>
>>> Hi Nuwan,
>>> Yeah - If we don't give a routing or controller mechanism to an
>>> application IMO it is not a framework. In the Store however the application
>>> logic itself has created this required framework level route and controller
>>> handling. What Absolute provide is a framework that will simply perform the
>>> below query
>>>
>>> For the given request - execute this function and generate this template
>>>
>>>
>>> How the function and template are found are up the implementation.
>>> Absolute eliminate the concept of .jag files and bring the front-end
>>> controller which wraps up everything and handle things via controllers. How
>>> we want the view to be rendered is also configurable - in the example I am
>>> using caramel to render the template (refer my above diagram).
>>>
>>> IMO Caramel at heart is a theming library that will theme the view
>>> according to the data provided. Absolute is built on the idea behind rails
>>> - where you have conventions on how things work.
>>>
>>> Since you guys are building the generic publisher - can you please send
>>> me the link for it so that we can follow a similar design.
>>>
>>> Thanks
>>>
>>>
>>> On Tue, Jul 30, 2013 at 11:00 AM, Nuwan Bandara <[email protected]> wrote:
>>>
>>>> Hi Chan, et.al,
>>>>
>>>> Am not sure if you have understood MVC in caramel correctly here. the
>>>> request does come to the controller in caramel as well, and at the
>>>> controller it creates the view-model [1] (according to MVVM). the only
>>>> difference I see in absolute is that, it takes care of routing too. IMO
>>>> that locks down to one url pattern.
>>>>
>>>> Anyhow if that's your choice its perfectly fine, once the request hits
>>>> you asset type, you can handle it from which ever framework/design pattern,
>>>> and we encourage that.
>>>>
>>>> Also we have started working on the publisher, it will have a similar
>>>> structure to the store. We will be dealing with life-cycles etc (registry
>>>> LC by default), if your life-cycle states cannot be mimicked by registry
>>>> LCs you can override that as well.
>>>>
>>>> the Store git repository is at [2], So from now on, you have to install
>>>> the generic store as an OSGI feature [3] into your distribution and copy
>>>> your extra scripts on top of that. Please do not take a copy of the store
>>>> because it will be continuously changing.
>>>>
>>>> Regards,
>>>> /Nuwan
>>>>
>>>> [1]
>>>> https://github.com/ruchiraw/wso2-samples-store/blob/master/index.jag
>>>> [2] https://github.com/wso2/enterprise-store
>>>> [3]
>>>> https://github.com/wso2/enterprise-store/tree/master/modules/features
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Jul 30, 2013 at 9:30 AM, Chan <[email protected]> wrote:
>>>>
>>>>> *Absolute.js*
>>>>> It's a front-end controller framework for jaggery. As opposed to
>>>>> Caramel - Absolute.js follows a controller first approach to MVC.
>>>>>
>>>>> Below diagram shows the difference of Caramel and Absolute.js
>>>>> [image: Inline image 1]
>>>>>
>>>>> What absolute.js lacks at the moment is the ability to intercept the
>>>>> view depending on the theme. This is a functionality provided by Caramel.
>>>>>
>>>>> I see Caramel as a theming framework rather than an MVC framework. We
>>>>> can combine both principles and build better framework. Then we will be
>>>>> overriding controller functions as opposed to the pages (.jag files).
>>>>>
>>>>> I have made the resolve functions pluggable to absolute.js  to support
>>>>> any kind of routing functions required.
>>>>> [image: Inline image 2]
>>>>>
>>>>> With the above method we can follow routes as -
>>>>>
>>>>> /publisher/api - API route
>>>>> /publisher/{assetType}/{controller}/{view}
>>>>> Eg:------------------------------------------
>>>>>
>>>>> /publisher/mobileapps/main/index
>>>>>
>>>>> If a person calls the /publisher/ this will call the main controller's
>>>>> index function which resides in a file called main.js in assets folder. 
>>>>> For
>>>>> more understanding please go through the github project.
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> On Tue, Jul 30, 2013 at 9:09 AM, Chan <[email protected]> wrote:
>>>>>
>>>>>> Hi all,
>>>>>> We have come to an architecture that will work in parallel with
>>>>>> absolute.js as well as caramel using each of the mentioned frameworks's
>>>>>> plus points.
>>>>>>
>>>>>> *Store*
>>>>>> Mobile Store will be developed according the generic store mechanisms
>>>>>> of overriding assets. All the API paths required will be at the apis.jag
>>>>>> located in the mobileapp asset folder. We will be adding some additional
>>>>>> partials required for the device level manipulations for the store.
>>>>>>
>>>>>> *Publisher*
>>>>>> We are going to redesign the Publisher main architecture and make it
>>>>>> according to the caramel themes.
>>>>>>
>>>>>> Below is the diagram of how a request will travel through the
>>>>>> Publisher
>>>>>>
>>>>>> [image: Inline image 1]
>>>>>>
>>>>>> Absolute.js will act as the front-end controller which maps
>>>>>> controllers to requests. The github repo for the sample is at -
>>>>>> https://github.com/dulichan/codewolf.
>>>>>>
>>>>>> For those who are not familiar with Absolute.js -
>>>>>> *Absolute.js*
>>>>>> --
>>>>>> Chan (Dulitha Wijewantha)
>>>>>> Software Engineer - Mobile Development
>>>>>> WSO2Mobile
>>>>>> Lean.Enterprise.Mobileware
>>>>>>  * ~Email       [email protected]*
>>>>>> *  ~Mobile     +94712112165*
>>>>>> *  ~Website   dulithawijewantha.com
>>>>>> *
>>>>>> *  ~Blog         
>>>>>> blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>>>>>> *
>>>>>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Chan (Dulitha Wijewantha)
>>>>> Software Engineer - Mobile Development
>>>>> WSO2Mobile
>>>>> Lean.Enterprise.Mobileware
>>>>>  * ~Email       [email protected]*
>>>>> *  ~Mobile     +94712112165*
>>>>> *  ~Website   dulithawijewantha.com
>>>>> *
>>>>> *  ~Blog         
>>>>> blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>>>>> *
>>>>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Thanks & Regards,
>>>>
>>>> Nuwan Bandara
>>>> Technical Lead; **WSO2 Inc. *
>>>> *lean . enterprise . middleware |  http://wso2.com *
>>>> *blog : http://nuwanbando.com; email: [email protected]; phone: +94 11
>>>> 763 9629
>>>> *
>>>> <http://www.nuwanbando.com/>
>>>>
>>>
>>>
>>>
>>> --
>>> Chan (Dulitha Wijewantha)
>>> Software Engineer - Mobile Development
>>> WSO2Mobile
>>> Lean.Enterprise.Mobileware
>>>  * ~Email       [email protected]*
>>> *  ~Mobile     +94712112165*
>>> *  ~Website   dulithawijewantha.com
>>> *
>>> *  ~Blog         blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>>> *
>>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>>
>>
>>
>>
>> --
>> Chan (Dulitha Wijewantha)
>> Software Engineer - Mobile Development
>> WSO2Mobile
>> Lean.Enterprise.Mobileware
>>  * ~Email       [email protected]*
>> *  ~Mobile     +94712112165*
>> *  ~Website   dulithawijewantha.com
>> *
>> *  ~Blog         blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>> *
>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>
>> _______________________________________________
>> Architecture mailing list
>> [email protected]
>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>
>>
>
>
> --
> Sanjiva Weerawarana, Ph.D.
> Founder, Chairman & CEO; WSO2, Inc.;  http://wso2.com/
> email: [email protected]; phone: +94 11 763 9614; cell: +94 77 787 6880 | +1
> 650 265 8311
> blog: http://sanjiva.weerawarana.org/
>
> Lean . Enterprise . Middleware
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 
Chan (Dulitha Wijewantha)
Software Engineer - Mobile Development
WSO2Mobile
Lean.Enterprise.Mobileware
 * ~Email       [email protected]*
*  ~Mobile     +94712112165*
*  ~Website   dulithawijewantha.com
*
*  ~Blog         blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
*
*  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to