News Feed
Jobs Feed
Sections




News Archive
Patrick Allaert's Blog:
Readable PHP code #1 - Return ASAP
October 14, 2008 @ 11:14:42

Patrick Allaert has made this recent post to his blog looking at something that a large group of PHP developers seem to forget about - readable PHP code. Specifically, he mentions the "return as soon as possible" mentality.

This is the first article of a series I will dedicate to tips to write PHP code that is easier to maintain, review, refactor,... These tips may be applied for other languages but are mainly focused on PHP. The first one could be entitled as "return as soon as possible.

He compares a code example - simplifying multiple if/elses, replacing the need for multiple nested evaluations that make the code harder to read. Check out the before and after to see how it helps the flow.

0 comments voice your opinion now!
readable return asap refactor ifelse nested


blog comments powered by Disqus

Similar Posts

Felix Geisendorfer's Blog: Cake 1.2’s Set class eats nested arrays for breakfast!

PHPMaster.com: Preventing Code Rot 101: Unit Testing

Padraic Brady's Blog: More OpenID (in PEAR and Refactoring)

James Morris' Blog: Removing Dependencies with the Observer Pattern (SplObserver, SplSubject)

Richard McIntyre's Blog: Weaving Lithium #li3 into a legacy PHP application incrementally


Community Events











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


language interview introduction database rest phpunit community framework conference functional symfony zendframework2 development release symfony2 usergroup opinion podcast testing series

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