News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

P
May 30, 2011 @ 09:48:29

Lukas Smith has a suggestion for developers out there who get the idea to start messing with the order of the parameters of PHP objects/methods - play nice. His example is specifically with Exceptions.

This is just a short follow up to a recent tweet of mine. I have seen this repeatedly happen, even to top notch and usually very careful developers (*). I am not sure why this mistake happens so frequently, but quite often you see code that changes the parameter order for custom Exception constructors. I guess it's mostly because in these cases the developer wants to pass some magic parameters that contain the message (and potentially also the code).

He recommends that, if you really do need to change something like the order of the parameters, use something like a factory to handle the reorganization for you.

0 comments voice your opinion now!
extend reorganization factory designpattern


blog comments powered by Disqus

Similar Posts

DevShed: The Basics of Abstract Factory Classes in PHP 5

PHPMaster.com: The MVC Pattern and PHP, Part 1

Pádraic Brady's Blog: Complex Views with the Zend Framework - Part 3: Composite View Pattern

NetTuts.com: Design Patterns: The Command Pattern

AskAboutPHP.com: CodeIgniter: Extending the native 'Model' and make it your own.


Community Events

Don't see your event here?
Let us know!


php7 laravel language unittest library example opinion podcast list voicesoftheelephpant release series api community video introduction interview framework version laravel5

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework