A question of ‘to bake or not to bake’
This question stucked me for some time now.. I even googled the question why use a framework before. (My framework of choice is MVC and cakePhp, so this will talk about the 2.)
There are many debates in determining if you need/want a framework or not. Here’s the opinion of Rasmus about MVC.
I don’t have much of a problem with MVC itself. It’s the framework baggage that usually comes along with it that I avoid. Parts of frameworks can be useful as long as you can separate the parts out that you need. As for MVC, if you use it carefully, it can be useful in a web application. Just make sure you avoid the temptation of creating a single monolithic controller.
It’s a matter of personal perspective in development, how well can you learn the framework in time and how patient are you to master this new tool to be able to use it wisely. As for me, I remember that I came to a point that I was so upset because I can’t do what I want. There are just so many things that I think are not useful and not possible in a framework. I like the simple call to query, I like the helpers a lot, I like the debugging tools, I like and dont like the foldering system, I like the team and the community who are very helpful at many times, I like the URL setup, I like and dont like the HABTM, I don’t like the documentation, etc. etc.. There are so many things that I like and don’t like just because they are new to me or they are hard to understand. But that’s how frameworks are, they teach you of something else out of your system. You may or may not like it at first but you’ll eventually learn and appreciate it. I didn’t like php at first because I have to learn a NEW environment again (I was a VB developer then, became a Mediawiki hacker(sort of)).
One important aspect that I liked in a framework, it guides you in a way everybody in your team will also follow. I am not the boss in our group so I can’t tell everyone that ‘hey, you should do this and that to make things clearer for me’ (in simple words, to please me and make my programming life easier). Rather, the framework tells us what to do and how to organize things. It is our manager. Eventhough frameworks acts like that, it should not limit you to do your job. I’ve learned from one of the cakephp team that once it makes your life harder, then just do it the way it’s easier. Frameworks should make our life easier, not the other way round. So today, I am not stucked to make it all ‘cakish’ unlike before when I was starting. As long as it works and it doesnt break anything especially the core, then I have no problem. I am still using php as my language and I should code like I used to be. To quote Rasmus, php always tries to find the shortest path to solving the Web problem, so cakePhp shouldn’t be a hindrance to that.
Again, frameworks should work as guidelines, not rules. Use it, dont make it use you. If you can do it in a better way, then just do it! If it doesnt help, move on and try something else. I am not stucked with how cakePhp should do it specially that it really lacks documentation right now. I’ll learn it on the way, while improving myself and my abilities in using it. As for now, just do it. (I am not a Nike fan, i read this in a blog before but can’t remember the url. I just love that line 😉 )
I’ll leave you with another perspective of another baker:
After these experiences with two different applications using cake, I guess it’s not a question of when or when not to bake, but rather, how you would actually do the baking. You can always bake, complex application or not, you just have to have a well studied and structured approach on how to bake your cake 🙂 .
Entry filed under: uncategorized.