On 8/10/2009 5:18 PM, Mert Oztekin wrote:
As I agree some of your thoughts, I want to add my opinion also.
Yes the code should work. That is why we earn Money. If it doesnt work, then we are on
fire. But things like OOP or MVC weren't invented for a better running code. They are
invented so the codes will going to be much more clean, readable, reusable, maintainable.
"Running codes" is not enough.
Eric asked about how his MVC structure looks. And we are trying to help what we know
about MVC. He didn't asked if the code is fine for running. So giving an answer "The
real key is, does it work, and can it be maintained" is not enough and not really
helpful to him on MVC concept. If you need just a running and maintainable project, you
don't need to use MVC (MVC is not all about that). We are not criticizing his code(the
code is really fine(except injection problem :-) ) and very readable)
As Martin said, All the business logic should be in Model. Controller should not tell a
model "Save it to this database, select it from this table, use this
db_adapter" etc. A controller is like a maestro of the system. It askes the model to
play piano loud. But it wont say which key of piano, the model should touch.
I suggest you to read this online book about Zend Framework and MVC. Its really
really very helpful to understand the concept. Also example codes are very
clean and good.
(sorry for my english)
Thanks for the link, it looks like an interesting read. Hopefully it
will help me understand MVC better and hence allow me to improve my code
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php