Warning: Constant ABSPATH already defined, this will be an error in PHP 9 in /home/killerph/public_html/wp-config.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at /home/killerph/public_html/wp-config.php:19) in /home/killerph/public_html/wp-includes/feed-rss2-comments.php on line 8
Comments on: PHP Design Patterns – when should they be used? https://www.killerphp.com/articles/php-design-patterns/ Thu, 09 Dec 2021 20:55:18 +0000 hourly 1 https://wordpress.org/?v=6.4.14 By: Doug @ Straw Dogs https://www.killerphp.com/articles/php-design-patterns/#comment-210 Sun, 23 Sep 2007 00:01:42 +0000 http://www.killerphp.com/articles/php-design-patterns/#comment-210 I rarely use design patterns in my PHP projects and seldom even use OO techniques. PHP has never really felt like a natural OO language and as such using design patterns in PHP code feels very strange and generally causes more trouble than its worth.

The MVC pattern is very common-place though and I think even small-scale projects can benefit from its use.

]]>
By: Hasin https://www.killerphp.com/articles/php-design-patterns/#comment-209 Thu, 17 Aug 2006 02:48:16 +0000 http://www.killerphp.com/articles/php-design-patterns/#comment-209 Stefan, some design patterns really helps to clean up your code and improve the performance. For a single page application no ones implement design patterns, for sure. But if you just use some basic OO and your application is full of classes which you need to cooperate often, I dont think there is any alternative but using design patterns. For example I can say Factory, Singleton are very basic design patterns and you know, every programmer should use them in their code, to avoid lousy coding and performance.

AOP and MVC is something which you should think when your application just just cross the boundary of “small-application”. But what if you implement MVC (I am meaning existing large scale frameworks) but you can just implement the MVC, if you think that it may help to maintain the code.

For a single developer project design pattern and these issues are less effective than a multi developer project. You know these things are invented just to maintain the usability of you code. So if there is no chance of reusing your code and no chance that in next few years you wont open old code files, why bother using design patterns?

I think Design patterns is much more effective on the context of Ruby and Java. PHP developers can still go boom without using it. But better learning it and practising patterns like Singleton, Factory, MVC and Active Record will also increase your market value which is not avoidable at all.

Thanks for writing a cool article.

Hasin Hayder
Zend Certified Engineer

]]>
By: stefan https://www.killerphp.com/articles/php-design-patterns/#comment-208 Wed, 16 Aug 2006 05:46:49 +0000 http://www.killerphp.com/articles/php-design-patterns/#comment-208 @root,

This was not intended to be an in depth examination of specific design patterns … I just wanted to make the point that we should not try to over-engineer projects.

“This is not revelation”

… Perhaps not, but the Java community would have done well by this a few years ago.

I was only trying to offer experience from a Java developer (since 2000) who has seen some crazy things in Java – things that the php world should avoid.

Final point, this website was put up to help total beginners .. web designers. For experienced people, some of the things I cover may bore them.

That said, my articles and videos will address more advanced concepts in time.

–

To be honest, I have to check into where the PHP community stands in terms of their level of sophistication:

Do you still design by inheritance or have you seen that it is better to design by interfaces? How about AOP or dependency injection … does object oriented PHP support those designs?

]]>
By: root https://www.killerphp.com/articles/php-design-patterns/#comment-207 Wed, 16 Aug 2006 04:21:31 +0000 http://www.killerphp.com/articles/php-design-patterns/#comment-207 And what ?
Where is exapmles ?

This is not revelation

(-1)

]]>
By: PHPDeveloper.org https://www.killerphp.com/articles/php-design-patterns/#comment-206 Mon, 07 Aug 2006 12:45:33 +0000 http://www.killerphp.com/articles/php-design-patterns/#comment-206 KillerPHP.com: PHP Design Patterns – when should they be used?…

…

]]>