News Feed
Jobs Feed
Sections




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

Andrew Podner:
Make it Testable-No Matter how Painful it is
April 04, 2013 @ 09:39:27

In a new post Andrew Podner recommends that, as you're doing your day to day development, you try your hardest to create testable code, no matter how painful it is.

I look at the situation we have gotten into by having this problem [of replacing a large legacy application], and frankly, it is like the tech version of 'Scared Straight'. The paranoia of such a far reaching application within the enterprise that absolutely has to deploy successfully and also be very flexible to meet the needs of the future have driven me to the point of near madness in trying to make sure this thing is bulletproof, enter Test Driven Development.

He includes an example situation he recently was faced with in his code...and opted for the "easy" way out (difficult to test). He talks some about the issues, dependencies and coupled code this has created. He does, however, show a solution to the issue - passing in the dependencies as they're needed, not defining them in the method.

For me, writing custom apps in an enterprise environment is not about rapid deployment and looking like a hero. It is about deploying software with a design life of 7-10 years, because the change management involved in deployment is not something you want be be doing over and over again. Testable code with 100% coverage of unit tests, well developed integration testing, and prolific use of tools like PHPUnit & Selenium are part of the development culture because while speed is important, durability is even more critical to business.
0 comments voice your opinion now!
testable code unittest tdd testdriven refactor dependencies

Link: http://unassumingphp.com/make-it-testable-no-matter-how-painful-it-is/

blog comments powered by Disqus

Similar Posts

PHP in Action Blog: Testing a Zend Framework action controller with View Helpers

Sebastian Bergmann's Blog: PHPUnit 3.4.0 (Release)

Brian Swan's Blog: Running PHPUnit in Windows Azure

Benjamin Eberlei: Traits are Static Access

Jani Hartikainen's Blog: Unit testing part 2: Writing and running tests


Community Events











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


release podcast security component example install application language performance hack framework package facebook project introduction symfony2 database hhvm composer unittest

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