I’ve been wondering, why lots of PHP-programmers invent their own wheels (CMS, CMF, ORM etc.?), when there are a number of ready practices, ready PHP classes. Almost all typical tasks, that you can face to in web-development, have been already realized in the frameworks.
Let’s draw a simplified parallel. Just imagine that you need to build a house.
If you build it without any framework using plain PHP, you will get a formless hut, shaped of natural clay. Probably it turned out to be lasting, but once you need to make some changes into the construction, it will cause you much headache, and even small changes in one part of the house will entail negative consequences in the other part.
If you build it with clay, though with the help of previously developed special clay frames (your functions library), you will build the house faster. But don’t forget that, firstly, you will have to develop these frames, and it will take you not one year of hard work.
In this case the best option seems to build the house using store-bought bricks or even the whole slabs. PHP frameworks are associated either with ready bricks, or with slabs. In case of using slabs the house construction takes less time, though every so often you have to file them by sizes. There are some moments in case with bricks as well, but it is much easier to reconstruct the house, built from typical “bricks”. Though, firstly, you will have to study brick types, sizes etc. The same is with PHP frameworks.
There has been held a survey, according to which 40% of PHP developers either write in plain PHP, or do not use typical solutions, such as web development frameworks. Why don’t they? Let’s read, and analyze the comments of the respondents, to understand why so many programmers prefer to discover the continents again.
• “I’m lazy to learn something new”. The most popular answer. Well, I have nothing to say here.
• “I’ll manage everything by myself. I don’t need these frameworks”. Some programmers consider themselves to be genius, who will write a solid source, and debug faster on their own, than the whole community do.
• “I’ve already had my groundwork, which are completed as a framework. I just don’t have enough strength and time to publish them”. By the way, there are lots of such people. At the same time, your own solution will never be standardized, it will never be comparable with any of other products, and it is the programmer who develops it, who can leave his job later, and his solution will become the employer’s headache.
• “Frameworks are too slow, they are humongous”. Here we can say, that literate caching is the solution. Moreover, there is a possibility in smart frameworks, like Yii or Zend to optimize everything you need.
• “A framework doesn’t work with the latest technologies, like PHP 5.3, and I want to”. Well, in this case you can turn your attention to Zend Framework 2 and Symfony 2.
• “Frameworks are not universal”. I can’t understand this comment at all. Frameworks were thought to be universal tools. They are much more universal than CMS. Here is an example: there are 5 components in Symfony, ZF is modular from the very beginning, thus it is possible to change the structure, and even the components of the internal arrangement.
• “Frameworks are too universal, you will have to spend much time to adapt them”. And writing the code grassroots will take you less time? This is true only for small tasks, but once various demands appear, the customer changes the conditions, the design changes, and you have no architecture, then you understand that it would have been better to work in the framework.
• “Frameworks make the structure much more complicated”. That is not true, as framework gives you a carcass, set of tools. Naturally, you will have to spend some time to study how it works, but once you do this, you will see, how your work is simplified.
• “I don’t like exterior frameworks, on the reason I like writing in plain PHP”. Well, in this case, let’s write applications in assembler, why not? In my point of view, by saying this, some programmers just cover their reluctance to learn a new PHP dialect as a framework.
• “Oldclients, oldprojects. There is a need to support them”. If you are not able to persuade the client to pay for the transition (which is more likely to happen), then you have no choice but to support.
• “Frameworks are good to practice at the initial stage, when your experience doesn’t allow you to write more complicated things”. Consequently, they give you superiority in the speed of development that is really important. The understanding, why we need standards comes with experience.
• “Why do I need frameworks, if I have CMS, which is sufficient for me”. Probably, you don’t need a framework in this case. Though if CMS is not enough (new demands, specification changes), you’ll have to think the question over again.
Now, you, please, share your thoughts about PHP frameworks? I’m eager to read about your experience, because, as you know, the truth emerges while arguing 🙂