NYCPHP Meetup

NYPHP.org

[nycphp-talk] Development methodology WAS: why does setcookiefail?????

Hans Zaunere hans at nyphp.org
Mon Sep 8 15:19:13 EDT 2003



Rudy Gamberini wrote:

> Hans,
> Was it by design that you picked db interaction (Model), Browser interaction
> (View), Application logic (Controller).  Sounds a lot like MVC architecture.

Yes and no.  I've always felt that a well designed and architectured site is divided up into these three main areas.  Regardless of the label, or the implementation itself, good design is good design.

> I have been building dynamic sites for a while now and have been use MVC as
> my approach. It is implement via three state machines, Business State
> Machine (Controller), Forms State Machine (View) and a Message State Machine
> (not part of the MVC).  Underneath it all is the database which goes almost
> without saying (Model).

I agree to a large degree.  All sites, no matter how complex, have these three main segments.  It's a matter of implementation, at the architectural and code levels, how successful and well designed a site is.

> I been using NetObjects Fusion as my html tool of choice and it has provided
> a framework that is very object like.  Hardly ideal but workable.
> 
> I try to be as object oriented in my approach as possible meaning that most
> visual objects carry with them their behavior.  As the business state
> changes the objects respond accordingly either by making themselves visible
> or changing configuration.  I have found that by focusing my design to
> individual objects, the implementation is greatly simplified.  While a
> complex page may consist of many individual objects they are all being
> driven by the business state machine.

Personally, I'm not a big fan of complex OO designs, especially in PHP4.  Putting aside performance issues, I've found classes/objects become inflexible and hackish as they start to grow in complexity.  And by complexity, I mean complex logic and processes; they're great for storing "physically" related data.  I think most would be hard pressed to show an 100% OO site.  There are always some "glue" functions, and instead of forcing a lot of logic into classes, a bit more equally weighted OO/procedural design can be great.

The most successful model I've found is a hybrid of OO and procedural.  That is to say, an object representing a more-or-less physical item or data, which is then processed and handled by various functions.  This is still MVC in an architectural sense, but I've found it allows a greater degree of seperation between logic and data.  Granted, with PHP4 you're not going to see much of a performance boost versus strict OOD.

Just a couple of cents,

H






More information about the talk mailing list