Most of us in ecommerce application development have already heard of Magento. Some would call it new ecommerce killer app. I myself stand with that statement for many of reasons. However I would like to call it with one more name, developer killer app. This developer killer is what I literally had in mind. Magento is currently one of the most difficult PHP systems out there a developer could learn and master.
So, what exactly makes Magento so hard? Short answer would be the lack of good, and I mean really good IDE studio. You know, like the one .Net guys and girls have, something like Visual Studio. Yea, here I go again giving praises to Visual Studio and monopolistic Microsoft although I make my living using open source PHP. I should really be a shame, right? Well, no!
Let me elaborate further. Magento is true example of PHP object oriented power. It is built on object oriented concepts from ground up. This is what makes him cool, flexible and crappy. Yea, you heard me, I said crappy. Since there is no open source IDE or even commercial one that can loop trough entire Magento directories and grab all those classes and their methods you’re doomed. Irony in all of this is that is not Magento’s fault at all. However, developer is left on the mercy of good old Find All command in his favorite editor to loop trough all Magento files in order to find classes and their methods. What I expect from IDE studio is to write something like
and to get the list of all the available methods. This way I don’t need to keep track of the objects context, that’s left for my IDE to take care of. This little thing can save you hours and hours of development and debugging.
Try opening, let’s say /app/design/frontend/default/default/template/catalog/product/view.phtml file and writing down something like
$object = new Varien_Object();
Whatever IDE you use, none of them won’t give you class list when you get to
$object = new
part. Basically it’s up to you to memorize all the class names you are to use in your development. Creating an instance of Varien_Object class is probably something you won’t do, however I hope you understand what I’m trying to say. Magento is massive, it comes with over 5000 files. There are over 2700 files in /app/code/core/Mage/ folder. Am I to loop trough all of those in order to get to know which class and function lies where? I don’t think so.
Object oriented programming is no holly grail, no rocket science it all about creating object instances, running methods on those instances and getting or setting instance properties. And that’s it! This however is what makes Magento so hard to learn. In small applications with just a few classes thrown around few files, it easy to grab you’re favorite text editor and do some magic. In Magento, this approach is useless. So where does this leave us? The way I see it, developer has two options.
Option number one is to stick with poor Magento Wiki and Magento Forum in hope to find useful information needed to develop or expand some Magento functionality or template. This however always leaves you one step behind competition using the same Magento in providing client services.
Option number two is to master the OOP in Magento, pick up the classes, their public methods and properties. Grab a peace of paper and you’re favorite text editor and search for major classes representing stuff like Product, Catalog, Image and so on. Then you draw some nice diagram giving you’re self some visual representation of entire system. This way you will be able to do that little step further and start writing you’re own classes by extending the existing ones.
This may seem like a tedious and time required task to do but until some ultra smart code completion support does not come out in some of the PHP IDE you’re basically left on you’re own.
I consider my self good at understanding and coding with OOP in PHP. I’m just having problems connecting those dots in Magento system cause it’s all so scattered around and my IDE has no clue about it. Don’t know about you guys and girls, but this fact drives me crazy.