News Feed
Sections




News Archive
feed this:

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

Brandon Savage:
The Cardinal Sin Of Object Inheritance
September 09, 2013 @ 12:38:04

Brandon Savage talks about the "cardinal sin" of working with object inheritance in PHP applications - adding public methods to a class that extends/implements another.

I know I've committed this sin, and you probably have too. The sin of which I speak is a grave one, and it violates several well known and established principles of object oriented application development. What is this sin of which I speak? It is none other than the addition of new public methods to an object that extends or implements abstract class or application interface, in violation of both the Liskov Substitution Principle and the Dependency Inversion Principle.

He talks some about the Liskov Substitution Principle first, pointing out that adding those new methods makes the new object non-replaceable as the Liskov principle requires. As far as the Dependency Inversion Principle, the practice breaks it because you'd be depending on those new methods as concrete, not abstracted from the parent. He makes a few recommendations as far as ways to prevent violating these principles including using multiple interfaces or creating multiple abstract classes for different public APIs.

0 comments voice your opinion now!
object inheritance sin solid principle public method violation

Link: http://www.brandonsavage.net/the-cardinal-sin-of-object-inheritance/

Alan Knowles' Blog:
Another 7 deadly sins for PHP
March 25, 2008 @ 11:19:29

In some thoughts related to the just-passed religious holiday, Alan Knowles decided to come up with another series of 7 deadly sins one could commit in their PHP (CMS) development.

Among those on the list are things like:

  • Defines for configuration
  • Filenaming
  • If your code is public, you should try not to ridicule yourself.
  • Mixing PHP and HTML

Check out the rest of the post and some of the interesting comments that follow.

0 comments voice your opinion now!
deadly sin content management system problem



Community Events





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


language series opinion package laravel api update install release deployment zendserver list interview podcast library symfony introduction tips framework community

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