Why Every Developer Should Write Their Own Framework
Out Of Date Warning
Languages change. Perspectives are different. Ideas move on. This article was published on November 6, 2009 which is more than two years ago. It may be out of date. You should verify that technical information in this article is still current before relying upon it for your own purposes.
Lots of people have the itch to write their own frameworks. They think that they can do better than Zend, Cake, Symfony, or application-level frameworks like Drupal. They’re convinced that those designers and developers made fatal flaws, and they can improve upon them. They’re just itching to give it a shot.
So for those of you wanting to write your own frameworks, feel free. But don’t even think about putting it in production until you’ve read this blog post.
Lots of times new developers are shot down from writing their own frameworks by bosses or community members who insist that “NIH” (not invented here) has no place in their organization or language. They’re told that the existing frameworks are the “gold standard” and that they should take the time to learn those, instead of toying with their own.
To me, that doesn’t make a whole lot of sense. When comp sci students are attending school, they (hopefully) learn C, even though that there are higher level languages that do many of the low-level functions of C automatically. Why do they do that? Because they need to learn the basics.
Elizabeth Smith says basically the same thing about frameworks in a tweet, when she said “I think every PHP developer should write a framework – not necessarily to use but to LEARN from, it’s amazing how many don’t know basics.” This drives home a very important point: writing your own framework is a fabulous learning experience.
Writing your own framework will force you to make architecture choices that will in turn make it easier to see the wisdom (or lack thereof) in other frameworks. It also forces you to make decisions that you might otherwise have thought you could avoid: architectural decisions, coding decisions, lack-of-time decisions. Suddenly, the other frameworks don’t seem so kludgy and awkward.
Programmers should be wary of putting their frameworks into production, but should be willing and able to write one if the situation calls for it. The tried, true and tested frameworks that are out there are more than sufficient to meet most needs, and anyone who writes a framework will quickly learn that the decisions of the framework authors are common solutions to difficult problems, and should not be taken lightly.
So feel free to write your own framework and learn from the experience. I know I have – I called mine Modus.
Write better object oriented PHP today.
Object oriented programming always leaves you with a headache. What if you could master it instead?Get the book now! »