Welcome Guest, Not a member yet? Register   Sign In
Putting the View back into MVC.
#6

[eluser]MadZad[/eluser]
Pygon,
First off, I'm sure you'll find that such mvc opinions are like snowflakes...

For my part, I started by writing all-in-one programs. First split off the view portion about '98, and declared it to be a very good thing. Found splitting model from controller to be needlessly annoying and resisted (or sometimes just didn't need) for years, but did come around and sorry I didn't embrace it sooner.

As with all things, it depends. What is your preference and who else is going to have to work with the code you write? How complex is your code? (short and kludgey is fine, but if it grows, un-kludge it) Will non-programmers be contributing to the view? (in my utopia, I provide the view's header/footer, a very simple data structure the screen needs, and a description of the functionality. then an html/css/graphic guru who isn't intimidated by code but won't write any - they implement the view)

My stock answer is to embrace MVC more, and I find CI helps me do just that. I try to keep all DB access in the model, all business logic in the controller, and the only code in the view is for making display decisions. This helps me and others to understand the code more quickly - and that leads to shorter bughunts (single most time consuming part of the dev process, imho) and quicker implementation of requirements changes. I've been known to have stakeholders that change their minds at the most inconvenient times - but I'm sure that's a unique experience. :cheese:

When logic starts creeping into the view, down the road this can lead to confusion if you expect to make business logic updates in the controller. Sure, logic will creep in, but recognizing when to refactor and move it to the controller (or in CI's case, perhaps extend a library or create a helper) is where wisdom and experience come into play.

So, generic advice is to aim for low coupling - the M, V and C, while dependent upon each other, should have contained functionality. Any of them should be easily readable and accomplish only what they need to.

Some advice from my uncle, who rightly taunted me for buying a combination string trimmer / leaf vacuum.
Quote:One tool, one job. You get a tool that does two jobs, and it'll do both poorly.

Edit: holy crap - there were no replies when I started typing and I'm the 5th reply. What a community!


Messages In This Thread
Putting the View back into MVC. - by El Forum - 03-12-2008, 08:21 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 08:38 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 08:43 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 08:55 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 08:58 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 08:58 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:11 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:15 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:16 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:27 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:31 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:35 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:36 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:40 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:45 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:49 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:53 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 09:54 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 10:03 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 10:08 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 10:16 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 10:22 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 10:30 AM
Putting the View back into MVC. - by El Forum - 03-12-2008, 12:30 PM
Putting the View back into MVC. - by El Forum - 03-12-2008, 05:44 PM
Putting the View back into MVC. - by El Forum - 03-13-2008, 01:06 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 01:32 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 01:59 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 04:03 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 04:53 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 05:20 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 06:25 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 06:33 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 06:55 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 07:17 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 07:26 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 07:37 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 08:18 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 08:41 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 09:08 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 09:12 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 09:14 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 10:00 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 10:01 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 10:46 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 10:49 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 10:50 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 10:54 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 11:46 AM
Putting the View back into MVC. - by El Forum - 03-13-2008, 12:13 PM
Putting the View back into MVC. - by El Forum - 03-13-2008, 12:21 PM
Putting the View back into MVC. - by El Forum - 03-13-2008, 03:02 PM
Putting the View back into MVC. - by El Forum - 03-14-2008, 07:56 AM
Putting the View back into MVC. - by El Forum - 03-14-2008, 08:11 AM
Putting the View back into MVC. - by El Forum - 03-14-2008, 09:35 AM
Putting the View back into MVC. - by El Forum - 03-14-2008, 09:46 AM
Putting the View back into MVC. - by El Forum - 03-14-2008, 09:51 AM
Putting the View back into MVC. - by El Forum - 12-19-2008, 03:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB