Do frameworks really help you develop better quality software, and at a faster rate?
June 11, 2011 10:50 PM   Subscribe

PHP framework users - are you able to develop faster and provide better quality software because of frameworks?

Not your standard which-framework-should-I-choose question.

I've been programming in PHP for a number of years, doing stuff from standard websites to custom online systems. No frameworks, all standard PHP.

It's come to a time when I need to speed up my development times, and am wondering if adopting PHP frameworks such as CakePHP might be the way to go. The projects that I'll be taking on involve a lot of CRUD-based database operations.

I'd like to hear from existing framework users - do you find yourself being able to develop faster due to frameworks? Are you at a stage where you absolutely-cannot-live-without-frameworks?

Or do you think the complications offset its advantages, and barebones PHP is still the way to go?
posted by arrowhead to Computers & Internet (6 answers total) 5 users marked this as a favorite
 
Absolutely, frameworks make a huge productivity difference. It's not that I can't live without a framework, it's that when I work without one, I invariably find myself creating my own--either copying convenient libraries I've built up, or patterns I've developed. Especially where CRUD applications are concerned, there's a lot of repetition that's very easily modularized. If you're not using someone else's modularization scheme, that's because you're rolling your own, consciously or not, at which point you should be asking yourself why you're doing that instead of using some other, more developed framework that's got more people behind it than just you.
posted by fatbird at 11:14 PM on June 11, 2011


I wrote my own - its a lot more barebones than any of the ones I've seen and I can take it apart if I don't need the whole shebang. A lot of the time I'm working on pre-existing code that doesn't lend itself to a wholesale conversion to MVC (or more specifically, the client just wanted this addition/modification, they're not paying you to convert the whole site and probably wouldn't be too happy if you just went and did it anyway). The thing I use most often is the data models. Creating a class that describes the data table and then just passing in the array of data (usually from $_POST) and doing $model->save() is a huge timesaver - no writing the sql statements, no cleaning or validating the data etc (all done automatically by the model). I'd like to say I couldn't live without it but I have to live without it too much of the time (I maintain a lot of websites that were very poorly written a long time ago)

If you write your own datamodel class (or are able to extract one from an existing framework) you can save yourself a huge amount of time on regular every day tasks. That and form generation (you're going to redo the other views/'scaffolds' anyway so they dont save much time) are the big timesavers, the rest is very situational. If you're doing a very basic CRUD site then yeah, it can save you some additional time and the organisation/consistency is nice but it can be constraining.
posted by missmagenta at 11:20 PM on June 11, 2011


Absolutely. For years I worked on standard PHP systems, but over the last couple of years I've been using frameworks both professionally and for my personal projects. The complexity of the frameworks differs drastically - the smaller, lighter frameworks (my experience is with Code Igniter, but there are others, Yii, Kohana, etc) are easy to use, and awesome for just setting up the nuts and bolts of a site without providing a lot of overhead or fancy features. The bigger frameworks (Symfony, Zend, etc) are huge mammoth things that do everything and then some, but have a much steeper learning curve. They are powerful, powerful tools, however. The use of proper frameworks has made me a better developer, allowing my to focus on the root of the problems without all the bookkeeping nonsense, and force me to write better, cleaner code. I will never, ever work on a site without at least some barebones framework in place, but definitely lean towards more powerful than not - you never know when those added features will come in handy.

The wheel has been invented many times, refined upon, and made both more generic and specialized. Might as well use all that to your advantage, instead of re-inventing it yourself every time.
posted by cgg at 11:48 PM on June 11, 2011


Frameworks, maybe. CakePHP, no. My experience with frameworks generally and Cake particularly has been that it takes so much extra time to get your own assumptions in line with the worldview of the framework developer that you might as well just be coding from scratch. Maybe you try a framework whose biases gracefully cooperate with your own, or maybe there's a crossover point where you can stop fighting the tool, but at the small-to-medium project scale I have focused on for the past eleven years, I have not found it.

MVC in particular is a pattern that I think just plain sucks for server-side web development. It's a clumsy import from the world of desktop and interactive applications where you have to manage persistent state. It makes no sense for stateless, isolated-request PHP development.

I'm still a big fan of barebones PHP, though I tend to make heavy use of PEAR libraries for database access and network operations and Smarty for templates. Fatbird makes a good point above, but just having people behind it doesn't make for a good framework: all those people have desires subtly different from yours, and once you step outside the core needs answerable by a set of well-chosen libraries, you're going to find yourself waiting in the development equivalent of a DMV line.
posted by migurski at 12:11 AM on June 12, 2011


By the way for some sense of where I'm coming from, spend a bit of time with Cal Henderson’s 2008 Djangocon Keynote, “Why I Hate Django”. Pretty entertaining, and a better explanation than I could offer of that crossover point from a deeply experienced PHP developer (Cal made Flickr).
posted by migurski at 12:17 AM on June 12, 2011


(he stops goofing off around the 16 minute mark)
posted by migurski at 12:25 AM on June 12, 2011


« Older Great Greek music?   |   Make her stop... Newer »
This thread is closed to new comments.