I will introduce the "Fluent Application" the idea is centralize and facilitate access "resources" and their use on sites that use Joomla!, and other applications. First I implement Joomla Application, but the idea is use the same thing for Wordpress, phpbb, Drupal, etc. You can use the same code in any application, just use the same DSL. This is cool for development on Joomla! usign in modules, components. So if developers use this on every extensions what the gain for community? We have service for construct our application(component, module, etc) let me try express better.

For example:

If we contruct a DSL for content, banners, virtuemart, sobi, docman, etc.
We can integrate all this things on same "application"(Component/Module).

Example of DSL:

First we get the Application with we need work on this case Joomla!

//instance the Joomla Application
$joomla = new FluentInterface('Joomla');
//connect to database
$joomla->configureConnection()
->host('localhost')
->username('root')
->password('1234')
->database('joomla_test')
->connect();

//now we can use Domains(Collections of DSLs).

$contentRows = $joomla->domain('content')->lists()->latest()->inOrder()->fromCategory()->withId(3)->getRows();
$docmanRows = $joomla->domain('docman')->lists()->latest()->withHitsMoreThan(10)->getRows();

In my idea I have think on construct a "widget"(like module on Joomla!) so we can get data and display usign this widget interface.

$widget->module('content')->addData('content',$contentRows)->addData('docman',$contentRows)->display();

So we instance Joomla Application, connect with this application and use Domains for get "Data". You can instance many of Joomla!s and this way make them change data with sameDSL. My ideas goes further.. I offer to you to connect in other applications and use the DSL for give Data and you can display on your application or use the Widgets.

Example:

$wordpress = new FluentApplication('Wordpress');
$wordpress->configureConnection()
->host('localhost')
->username('root')
->password('1234')
->database('wp_test')
->connect();

$wpPosts = $wordpress->domain('posts')->lists()->withStartDate('2009-09-29')->withFinishDate(''2009-10-01')->getRows();

//use widgets to display data if want
$widget->module('wp_content')->addData('content',$wpPosts)->display();

So this way we have a service between application and you can share data. But remember we can implement others things like:

If you need send e-mail you dont know how Joomla, Wordpress does we can have a DSL for E-mail like:

//wp use
$wordpress->service('email')->from('juliopfneto@gmail.com')->to('wilco@joomla.org')->subject('test')->body('text body')->send();

//joomla use
$joomla->service('email')->from('juliopfneto@gmail.com')->to('wilco@joomla.org')->subject('test')->body('text body')->send();

I have implement more part of this code. Widgets is not implement today. If you see the map maybe you can have the Idea how is my fluent application.

Now let start the discussion.. tell me what you think, give opinions.

Views: 75

Attachments:

Replies to This Discussion

I just have this implemented, but not make all tests. But I implement only Joomla, so you can get data of many sites with Joomla. I need to test and create another application for my framework.
I will write how works framework, this way we can work together. We can construct this framework not just for CMS but phpBB, vignete, and more..
Júlio, I've seen many posts of you regarding DDD here and on the dev lists. So I decided to ask my questions about all of them in this thread:

1. What you offer is a really nice idea and both Joomla developers and the Joomla-project itself would definitely gain from having your features implemented.

My question is: Have you already done some coding? If yes, how much code do you have completed on your ideas scope? Please don't understand me wrong, I like the idea but if I got it correctly (if I'm wrong please correct me) — it will require to rewrite almost all framework classes and probably all core extensions? Isn't it too ambitious? When it comes to this I always don't like to run to an extreme — everything in a reason.

2. Could you please clarify point by point what steps have to be done to implement all your goodies in Joomla project and how do you see this?

Thanks in advance. Keep good things happen.
com_home - use Fluent API to conect in 2 site in joomla and get data.
fluentapps.zip - extract in root folder this contains the Joomla Application base usign Fluent Interface
fluentapplication.zip - librarie framework

1) extract the fluentapps/ in root of Joomla site
2) extract fluentapplication to libraries/fluentapplication
3) extract com_home in components/com_home

4) edit components/com_home/home.php
4.1) configure the connection lines 12 and 23
Ex.: $site1->configureConnection()->host('localhost')->username('root')->password('')->database('joomla_site1')->prefix('jos_')->connect();
//configure connection
$site2->configureConnection()->host('localhost')->username('root')->password('')->database('joomla_site2')->prefix('jos_')->connect();

4.2) if you want change the DSL check the name of category

$contentData2 = $site2->domain('content')->lists()->latest()->published()->fromCategory()->withName('News')->andContent()->inOrder()->getRows();

5) access index.php?option=com_home

this will get Data from both sites usign same language to comunicate now imagine develop extensions with this, integrate more applications, etc. This is a example test.
For this Idea I think we need test and bugs for Joomla! application. I think its finished the beta.. with one application(Joomla) more applications can be added like Wordpress, etc. We can talk via skype I think is better to share my idea, and explain how works, etc.
You rock. Glad to see others working with you.
Julio, this is very very cool. Thanks for sharing!
new com_home
Attachments:
you need to change withName('Notícias') with category name if you wish or use:

$site1->domain('content')->lists()->latest()->published()->inOrder()->getRows();

same for $site2

$site2->domain('content')->lists()->latest()->published()->inOrder()->getRows();
Julio - would you be willing to do a broadcast with ustream.tv and explain the significance of your work and how to use it?
Sure.
Amy, when we can do?

RSS

Badge

Loading…

© 2012   Created by Amy Stephen.

Badges  |  Report an Issue  |  Terms of Service