User tests: Successful: Unsuccessful:
Example conversion of com_weblinks for Single Task Controllers #3503. Still a work in progress, but I
almost have the entire back-end functioning. This pull request is for demonstration purposes only.
Current lines-changed stats: +5,374 lines added −750 lines removed.
I thought the same, but then saw that it includes the single task controllers in the library (I think 28 files?) which are reused across extensions. However it's still a lot of files that need to be changed.
It would probably make more sense to make a PR once it's finished, not while it's in progress.
@beat
I'm not sure if there will be more or less code once this conversion is finished. I added the controllers, models and views to support the new system. However there will be a big drop once I delete the pluralized weblinks model and view.
Also I had to build some workarounds for JHtml::JGrid because the task position is fixed for all of the controls. So this demonstration won't be an accurate representation of the code reduction.
The real benefit will be gained from the conversion of all the extensions. So the first one might actually require an upfront investment ( added code)
@Bakual
I'm a bit of a noob when it comes to github. I wanted to give you and everyone a chance to see what I'm doing (and keep the conversation going), but didn't know how to make this repository show up in the Single Task Controller RFC without making a pull request with a reference.
By the way, you can see what the allowAction method looks like in JModelCms and how I handled custom ACL for the WeblinksModelWeblink. Let me know what you think.
I'm a bit of a noob when it comes to github
One way is to just use the compare link. You get that in the step just before you create a PR.
Like this: https://github.com/Mathewlenning/joomla-cms/compare/com_weblinks-example
By the way, you can see what the allowAction method looks like in JModelCms and how I handled custom ACL for the WeblinksModelWeblink. Let me know what you think.
As for view specific controllers: com_config seems to use a subfolder approach where the single task controller are in a folder named like the view. See https://github.com/joomla/joomla-cms/tree/staging/administrator/components/com_config/controller
The custom ACL was only an example. There may be other differences which can't be solved in the model.
That might be true, however in my opinion Joomla has already out grown the current MVC.
I can tell you are going to be a hard sell for this solution, so why don't we work together and expose this single task controller systems weaknesses.
You are obviously very knowledgeable in regards to the current implementation, so if you'll highlight possible situations in the current CMS where this design won't work. I'll brain work the solution.
If we come across something that can only be achieved in a multi-task controller, then I'll work with you to build and test the better multi-task controller you envision for the future of Joomla!
Sound good?
Sincerely,
Mathew Lenning
Babel-university.com
P.S. This message was sent via iPhone, so please forgive any errors
On Apr 29, 2014, at 2:49 PM, Thomas Hunziker notifications@github.com wrote:
I'm a bit of a noob when it comes to github
One way is to just use the compare link. You get that in the step just before you create a PR.
Like this: https://github.com/Mathewlenning/joomla-cms/compare/com_weblinks-exampleBy the way, you can see what the allowAction method looks like in JModelCms and how I handled custom ACL for the WeblinksModelWeblink. Let me know what you think.
As for view specific controllers: com_config seems to use a subfolder approach where the single task controller are in a folder named like the view. See https://github.com/joomla/joomla-cms/tree/staging/administrator/components/com_config/controller
The custom ACL was only an example. There may be other differences which can't be solved in the model.�\
Reply to this email directly or view it on GitHub.
I can tell you are going to be a hard sell for this solution, so why don't we work together and expose this single task controller systems weaknesses.
Hmm? Which solution? To my knowledge we currently have two places where we are using the new MVC. One is com_config and the other is the installation. Both already use a single task controller as far as I'm aware. I just think it makes sense to look at the implementation there.
To me it makes sense to be able to have specific controller "overrides" for a given view. So if my view "foo" needs a special "edit" task, then I can put it into controller/foo/edit.php. If "bar" doesn't need it, it will just use the library controller and I don't have to do anything. Would that make sense?
I don't have a problem with a single task controller if it's in the end easier to work with. I'm just not yet convinced that it will be. But I'm absolutely aware that this might be just me not seeing the picture. I haven't decided yet
Labels |
Added:
?
?
|
After contemplating the changes that are going on in JTable, I think its best not to extend JTable at the moment. So I'm going to close this branch and start another rewrite which includes the re-factoring I've been doing on the controllers, models, views.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-05-06 14:24:58 |
Hi Mathew,
Thanks for your work in showing how the single controllers could reduce duplicate code. For now I see in this example: Current lines-changed stats: +5,374 lines added −750 lines removed. As this is work in progress, is that going to change massively in your example ?