Page 2 of 2
Re: Shouldn't the MVC become MVCS
Posted: Mon Oct 06, 2008 2:12 pm
by Christopher
VladSun wrote:OK, I surrender
It all started because of the many similarities between the View and the Storage layer.
I'll try to implement a prototype some day, but for now it's not clear enough even for me, haha
Thanks again guys.
Don't surrender, I still have not understood what those similarities are that you are seeing. You can't just leave use confused!

You may be on to something interesting...
Re: Shouldn't the MVC become MVCS
Posted: Mon Oct 06, 2008 2:16 pm
by Christopher
webaddict wrote:User::render( ); // for displaying purposes.
User::save( ); // for persisting into a Mysql database.
User::login( ); // querying the database.
User::setPassword( ); // for changing the password.
Now, think it through. Which reasons can there be to change the object? The displaying may vary (xml, html). Persisting might vary too (say I want to use a better database, such as Postgresql), logging in might change. Setting the password however isn't something expected to change. Now think about the principle: "encapsulate what varies". What've you got left? Yes, something that renders, something that controls, ( something that contains the bussinesslogic and something that persists).
That is a really excellent description of how you use SRP to go from monolithic code to modular code -- ending up with MVC. Very nice ... it adds another perspective from which to understand MVC!
Re: Shouldn't the MVC become MVCS
Posted: Mon Oct 06, 2008 7:33 pm
by josh
Database tables can be referred to as "views", I think what he's getting at is that you might want to change code to not output a table, but maybe save that data to a database and forward to some other action ( changing an action that renders models to an action that persists those models ), like instead of passing a model to the view renderer it'd be passed to a data mapper, but this would still be following MVC ( unless you implemented that data mapper as a view ), the only thing you'd be changing is the controller
Re: Shouldn't the MVC become MVCS
Posted: Tue Oct 07, 2008 2:45 am
by josh
Re: Shouldn't the MVC become MVCS
Posted: Tue Oct 07, 2008 3:29 am
by Christopher
I really don't see how that is any different than a Front Controller and Router. He calls is 'ports' but it just sounds like a dead-end version of routes. I am always suspicious of anything around Responsibility Driven Design, which seems like a mini-alternate-universe with different names for many common ideas and patterns.
Still I am confused...
Re: Shouldn't the MVC become MVCS
Posted: Tue Oct 07, 2008 5:42 am
by VladSun
jshpro2 wrote:Database tables can be referred to as "views", I think what he's getting at is that you might want to change code to not output a table, but maybe save that data to a database and forward to some other action ( changing an action that renders models to an action that persists those models ), like instead of passing a model to the view renderer it'd be passed to a data mapper, but this would still be following MVC ( unless you implemented that data mapper as a view ), the only thing you'd be changing is the controller
Yes, it's the closest description (and it's in better English than mine, hahaha).
Re: Shouldn't the MVC become MVCS
Posted: Tue Oct 07, 2008 9:59 am
by webaddict
arborint wrote:That is a really excellent description of how you use SRP to go from monolithic code to modular code -- ending up with MVC. Very nice ... it adds another perspective from which to understand MVC!
Thanks arborint, I'll take that as a huge compliment, coming from someone with your knowhow.