Fork me on GitHub

Subject:*
Name/Email:*
Message Icon:*
Message:*
url email imgsrc image php hide code quote
SAMPLE
alignleft aligncenter alignright bold italic underline linethrough   


 [more...]
Options:*
 

 

 
View requirements*
Reply No requirement
Confirmation Code*
  The code is case-insensitive  Click the image for a new code. | Maximum attempts: 8
     
Re: MVC architecture, routers and other stuff

by Madfish on 2019/5/4 2:13:20

What I'm liking about the router + MVC-type approach is that far less code has to run to deliver a page. eg. my current modules have Ye Olde Traditional handler classes for each object, and these are huge because they hold the code to handle all actions for their client objects.

With the strict MVC approach these monolithic handlers are getting chopped up into smaller model classes, each of which only deals with a specific page view (one or two different actions, as opposed to everything), and the router selects which one to load. So there's a lot less stuff to read for any given page load.


Re: MVC architecture, routers and other stuff

by fiammybe on 2019/5/3 6:50:12

Yes, specific routes that take their input from the symlinks that are already present, with the fallback to 'standard' module routes. That would be great to have.


Re: MVC architecture, routers and other stuff

by MekDrop on 2019/5/3 0:30:08

I have made some progress with 2.0 and routing -> https://github.com/MekDrop/impresscms/tree/use-league-router . However right now I haven't figure out how to register routes for modules. But I hope somehow I will solve this and than this functionality will come to icms.


Re: MVC architecture, routers and other stuff

by fiammybe on 2019/4/11 2:31:10

I have already come across Tom Butler's articles (hard to forget him, with his exuberant hairstyle profile photo ) and he has some very interesting points, yes. I admit I'm also no rockstar developer in PHP to be able to follow the entire reasoning in 1 go. Some kind of url routing would be interesting to have in ImpressCMS2 (2.0 or a later iteration), for a start.


MVC architecture, routers and other stuff

by Madfish on 2019/4/10 19:51:36

I've been looking into the MVC pattern, and came across a programming blog that has some very interesting articles about MVC and a couple of its descendants - MVVM and MVVMC. Also has some cool stuff about how to build a front end controller to handle routing.

https://r.je/

It took me a few reads to get my head around it. I thought I had been doing MVC, but it turns out not in a very strict sense. Anyway, I'm trying to build something using a front controller and the MVVMC pattern, which is basically MVC except the view gets split into two components (a view plus a 'viewmodel') to decouple the view from the model and allow each component to be substituted or re-used. Together with the front end controller/router it gives you a lot of flexibility.

Worth a read if you have time (see the section 'MVC Related Articles').