[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [jfw] Discussion - Package Updates for Framework 2.0

On Saturday, April 12, 2014 12:53:30 PM UTC-5, Sven Versteegen wrote:
Actually, should I start a new thread on
experimenting with new patterns for building modules and components
using the native Framework (aka, HelloWorld on the FW)?
For REST based applications I prefer a RMR architecture (www.peej.co.uk/articles/rmr-architecture.html), if you bring formats in the get() method would change to getHtml(), getJson() etc.
In a very simple resource(component) method class, what uses .md files for the content, the class has only 113 lines (empty lines included) and is able to show the content in html, json, txt and xml.

Thanks for sharing that link - I had not heard of RMR although that's more along the lines of how Molajo works.

IMO - the problem with Joomla's implementation of the MVC is that a component couples these elements. And yet, the benefit to the MVC is separation of these three elements. The Joomla CMS doubles this problem by separating the component into two pieces in support of the application structure -- the administrator and the site -- and doing so prevents (easy) reuse even within a component. 

I followed a few principles that helped overcome that coupling:
1. PHP classes should *never* render HTML.
2. Views should only contain HTML and injected data. Views are not a PHP class, should never instantiate a PHP class, nor should they execute class methods. The only logic a view should have is in support of rendering.
3. Resources (components) are assigned three views for basic functions: 1) List, 2) Item, and Edit.
4. Menu  items create new views or link to existing resource views.
5. Include statements (JDoc) can render any view with any resource input.
6. Plugin events produce data that the Renderer uses, in conjunction with the view location, to render output.

Those principles helped simplify the architecture and bring in expected flexibility. There is no need for HMVC because any view can be rendered on any page. There is no MVC coupling within the component  because a component is simply a resource, it has no MVC. (Though, it does have View assignments.) and so on.

I would definitely recommend setting principles for the FW development because it helps guide how the architecture emerges. If you don't compromise the principles, you'll make the code support the principles you establish.

Framework source code: https://github.com/joomla/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-framework+unsubscribe AT googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.