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

Rob Allen's Blog:
What problem does dependency injection solve?
Feb 20, 2012 @ 15:37:15

In his latest post Rob Allen seeks to answer the question "what problem does dependency injection solve?":

Zend Framework 2 comes with a dependency injection container (DIC), as does Symfony 2 and Aura, along with many other PHP frameworks that target PHP 5.3 or hight nowadays. This article attempts to explore the problem that a DIC tries to solve.

He gives an example (somewhat based on the same structure of his Zend Framework tutorial) showing how you could use DI to inject the Artist object into the Album object. This allows for more flexibility if more Artist types are added (extending the main Artist, of course). His second example shows how to use a DIC to hold album information.

tagged: dependency injection tutorial example container artist album

Link:

Fabien Potencier's Blog:
Developers should be Artists
Aug 26, 2009 @ 15:17:14

Fabien Potencier has a suggestion for developers out there - don't just look at what you write as something functional that just does a job, be an artist!

Hacking is an art, and hackers should act as artists. Hackers and painters have a lot in common but I won't talk about the analogy too much as Paul Graham wrote an excellent essay and a whole book on this topic. I recommend you to read both of them if you are a hacker or a developer.

He points out that "beautiful code" is a good thing - unfortunately developers for companies may not have the luxury of writing it. He does suggest hacking on your own time, though. Not only is it good for you, getting out those ideas into working code, but it can also positively effect the applications you develop at your work.

tagged: developer artist hack beautiful code

Link:


Trending Topics: