0

A number of the sites I've recently inherited are in various versions of FW-1 (a "light weight" Model-View-Controller framework for ColdFusion.) I have a functional grasp of it as it is in place, but I'm not seeing the advantages of using it in future development yet.

If you would, please briefly share with me specific experiences in which and how using MVC patterns or frameworks in a database driven web-development environment accelerated the development over what would have been possible in a more linear component function system.

If for moderation purposes only a technical question that can be "answered" is satisfactory, then it is "How does use of MVC patterns or MVC frameworks realistically or in practice accelerate development? (Examples appreciated.)"

Maxhirez
  • 99
  • 7
  • many ways :) For example: Proven in production (bugs have been found and fixed), Documented, Convention over configuration (you write less code so less time and less bugs), REST support, routing, nested layouts, Community support. Dependancy injection, reduced maintenance (as the app grows), environment detection, separation of concerns (that's the MVC bit leading to code re-use and easier to test code) that's just a few off the top of my head. – John Whish Mar 16 '16 at 22:14
  • I'll add that if you hire a new developer, if they have experience in your MVC framework (or similar MVC framework), they can be productive right away rather than having to muddle through and learn whatever home-cooked infrastructure you have. It forces you to conform to a convention that other devs can easily learn and follow. – beloitdavisja Mar 17 '16 at 12:29

2 Answers2

1

I do use FW/1 for almost everything. The balance is done in ancient Fusebox which in some ways like FW/1. For me it has to do with

Encouragement of division of code

After you start doing MVC on any platform, code starts to just naturally divide itself. It is a model, controller, or view? Is this model transient or not? Should the model have a routing pattern? Is this really a view or a layout or a part of a nested layout?

Self documentation

I had over my code to another developer, they instantly know what kind of a thing they are dealing with. It is in certain directory, it has to be a certain kind of thing

Expanded lifecycle

application.cfc has its lifecycle. FW/1 expands it enormously. There are all kinds of places that certain types of code is just supposed to go.

Consistent URLs

The routing patterns defines what kinds of requests will work and which won't. It self-documents the app.

Last but not least

If you don't like all these features, great. Then just tap into the ones you do like. You can ramp up as desired.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • 1
    If Fusebox is liek FW/1 to you, I fear you are using one of them the wrogn way. ;-) – Scott Stroz Mar 17 '16 at 12:12
  • Thanks for taking the time to answer, James! Is there any way I could get you to expand on this? For example, explaining a little bit how the specific type of division of code offered by FW1 as opposed to what is most direct for the project at hand would be useful. Or, showing how the section.item routing pattern's defining what requests work in FW1 is different from and faster than being cognizant of the definition of links in a manner consistent with how directories work-that level of understanding is what I'm hoping for. – Maxhirez Mar 17 '16 at 15:16
  • @Scott Stroz: I have to admit that the code base I worked on what quite messy for a while. But it did give me a migration path. – James A Mohler Mar 17 '16 at 15:37
  • @Maxhirez: FW/1 does have examples in Github. I recommend trying stuff and posting it here or on http://codereview.stackexchange.com/ . Lastly, in my profile there is a link to my Gibhub work which almost all FW/1. – James A Mohler Mar 17 '16 at 15:39
0

I never heard about FW-1, so my answer won't be related with this particular framework. I have experience of CF9 and Railo with ColdBox and Lucee with CFWheels.

All the merits of MVC I found during my work in CFML (I don't want to provide you general answer related with other frameworks I know - Ruby on Rails or Django):

  • Models are related only with DB staff. Maybe it's funny, but that's how it supposed to be. Sometimes is not. I've seen a lot of legacy code, which meant to be models, but was everything in one place. If business logic in models is isolated from the rest it's easier to test it and maintain it. Also- separated models allows you to use ORM.

  • Controllers are way much thinner. If you need type less code to do the same job, you'll do it faster.

  • Templates are only to display what we need, but they don't contain any business logic inside. Keeping it in that manner allows my company to hire front-end engineers, which works on CSS, JS etc. and if they touch CF code, they touch ONLY templates. It would be very difficult for them to deal with all i one applications.

Also I found myself more productive when I know where's find a method which I want to use or simply fixing the bug. If you apply MVC, you can narrow easily possible area of damage when things go wrong and believe- they will.

TL; DR: MVC makes your development faster, more robust and allows you to split work for different types of developers.

PatNowak
  • 5,721
  • 1
  • 25
  • 31