News Feed
Sections




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

NetTuts.com:
SOLID Part 1 - The Single Responsibility Principle
December 16, 2013 @ 13:10:55

NetTuts.com kicks off a new series of posts today with this first article covering the SOLID development practices. SOLID is a set of principles that can help make your code more robust and well structured in the long run. In this first post they jump right in with the first letter - "S" for Single Responsibility Principle.

[The Single Responsibility Principle] is one of the five SOLID agile principles. What it states is very simple, however achieving that simplicity can be very tricky. A class should have only one reason to change. But why? Why is it so important to have only one reason for change? [...] Even though you may not use a compiled language, you may need to retest the same class or module for different reasons. This means more QA work, time, and effort.

They go on to talk about how to figure out the "audience" for your class and how that effects what it should contain. A few "class examples" are shared in the post including objects that can print or save themselves. There's a bit of talk about software design ideas to consider and a less obvious example that might be breaking the principle (and how to fix it).

0 comments voice your opinion now!
solid design principles single responsibility principle

Link: http://net.tutsplus.com/tutorials/php/solid-part-1-the-single-responsibility-principle/

blog comments powered by Disqus

Similar Posts

NetTuts.com: SOLID: Part 3 - Liskov Substitution & Interface Segregation Principles

PHPClasses.org: Site design theme editor

PHPFreaks.com: Design Patterns - Strategy/Bridge, Value Object, Singleton (Registry)

DevShed: The mysqli Extension and the Active Record Pattern

Benjamin Eberlei: Doctrine and SOLID


Community Events





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


wordpress introduction community unittest api language bugfix threedevsandamaybe release application code series laravel developer podcast configure interview library list install

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