tags:

views:

94

answers:

3

I'm building a site like SO using PHP as a personal project. I started out with writing flat PHP files (the kind with SQL queries mixed in with HTML). After doing a few pages I noticed that it was getting hard to maintain. So I started using an ORM (Propel). Then I got introduced to Symfony.

I started refactoring my code to fit in with Symfony's MVC pattern. To me, it seems that for a small project such as this Symfony actually makes things more complicated and I actually develop slower. Are frameworks more geared towards large applications designed by multiple teams? Or am I doing something wrong?

+1  A: 

It depends upon the framework and how much you wish to trade off ease of development in the future with speed of development in the present. The best way to get to the bottom of it is to try out a few frameworks and see what suits you best. A few random examples include:

I have used all of the above and I personally found Agavi to be the best, although certainly not the quickest to work with. I was not so impressed with Cake as the rest, but again this is personal preference.

Treffynnon
+4  A: 

Any framework or new technology will have a learning curve during which you will seem to go slower. If you follow the MVC pattern and best practices for your framework, you will generally end up with cleaner, more maintainable code. There is some overhead to MVC and to getting things structured well. This overhead will payoff more for larger projects, projects that last longer (lifespan of the site as well as development time), and for projects with more developers. For small sites that will not be maintained, the overhead can be too large to be worthwhile.

If you're going to write PHP professionally, or you intend to write seriously, your time is well spent learning a popular framework or two.

Also, in no way is "a site like SO" a "small project."

Scott Saunders
+1 for learning curve, +10 for larger payoff over the long run.
banzaimonkey
Completely agree. New technology seems tedious until you spot the magic ;-) The last 10 spare-time projects I started all begun with "This project is too small for using symfony"... And then a few days later: "Damn, I need to rewrite this"... Point is: If you already got past the learning curve, there are very few cases where using a framework will not be justifiable.
phidah
A: 

I don't know how "small" your project really is, but even though it takes time to learn a framework and design your project so that it follows the framework's philosophy it's usually worth it.

In my experience, when projects start to grow like your project apparently does (naïve PHP → factoring out the model → ...) you end up, in the best case, with code very similar to a simple framework. When you are using a framework on the other hand, the basic design of your project is usually really well thought-out, so even if you are not an experienced software architect (maybe you are?) you will get a good foundation for your project.

Also, you say that it is a personal project so I guess it's some kind of hobby or educational thing. Using a framework can be a nice way to learn about design patterns and best practices in web development.

Perhaps Symfony is not the best choice for you. I guess it's a matter of personal opinion in the end. Personally I like CakePHP when coding PHP and Django when coding in Python.

André Laszlo