RE: Insult my code!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Paul,

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)


Eric,

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.
http://www.survivethedeepend.com/zendframeworkbook/en/1.0


Take Care,

Mert
(sorry for my english)


-----Original Message-----
From: Paul M Foster [mailto:paulf@xxxxxxxxxxxxxxxxx]
Sent: Wednesday, October 07, 2009 7:54 PM
To: php-general@xxxxxxxxxxxxx
Subject: Re:  Insult my code!

On Wed, Oct 07, 2009 at 05:34:35PM +1100, Eric Bauman wrote:

> Hi there,
>
> I'm in the process of trying to wrap my head around MVC, and as part of
> that, I'm attempting to implement a super-tiny MVC framework.
>
> I've created some mockups of how the framework might be used based
> around a very simple 'bank', but I'm trying to get some feedback before
> I go and implement it, to make sure I'm actually on the right track.
>
> Any thoughts would be much appreciated!
>
> Model - http://www.pastebin.cz/23595
> Controller - http://www.pastebin.cz/23597
> View - http://www.pastebin.cz/23598
> Template - http://www.pastebin.cz/23599

Your code (what there is of it) is fine. Beware of people who criticize
your code on purely academic criteria. There are a lot of differing
opinions about MVC, much of it driven by people making academic points
versus people who actually code for a living. Even some people who
actually code for a living fall under the spell of academic rules about
this or that.

The real key is, does it work, and can it be maintained. If so, don't
worry about people who argue esoteric points about what should or
shouldn't be in models and controllers, etc.

Paul

--
Paul M. Foster

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Bu mesaj ve ekleri, mesajda g?nderildi?i belirtilen ki?i/ki?ilere ?zeldir ve gizlidir. Size yanl??l?kla ula?m??sa l?tfen g?nderen kisiyi bilgilendiriniz ve mesaj? sisteminizden siliniz. Mesaj ve eklerinin i?eri?i ile ilgili olarak ?irketimizin herhangi bir hukuki sorumlulu?u bulunmamaktad?r. ?irketimiz mesaj?n ve bilgilerinin size de?i?ikli?e u?rayarak veya ge? ula?mas?ndan, b?t?nl???n?n ve gizlili?inin korunamamas?ndan, vir?s i?ermesinden ve bilgisayar sisteminize verebilece?i herhangi bir zarardan sorumlu tutulamaz.

This message and attachments are confidential and intended for the individual(s) stated in this message. If you received this message in error, please immediately notify the sender and delete it from your system. Our company has no legal responsibility for the contents of the message and its attachments. Our company shall have no liability for any changes or late receiving, loss of integrity and confidentiality, viruses and any damages caused in anyway to your computer system.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux