Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some of my friends and I started a PHP project some weeks ago. In the beginning, I suggested we use a PHP framework such as CodeIgniter or Zend. But my friends wanted to start clean and without the overhead or extra complexity.

But as time has passed, the project has become more and more complex. At first, we wrote all the code in the view files, in code blocks before the HTML output. Eventually, we changed direction and started to use controllers that did most of the work. But as you can see there is a coding difference here.

At this point, we're trying to determine how to proceed before the project becomes more complex. When does it make sense to start over and use a framework? Or is it possible to formulate a simple way to introduce an MVC pattern to our existing code without having to start from scratch?

share|improve this question
I roll my own framework so I can't answer the question, but it's a good one. +1 – Teekin Sep 27 '11 at 21:27
up vote 1 down vote accepted

Ugh. That's a complicated question that I've always struggled with. My first projects started like yours did. We ended up doing complete rewrites about 2 years into each project whether or not we wanted to. I'd advise either doing the painful thing now, or planning on doing it at a set time.

The awesome thing about switching to a framework is that they usually came with unit testing, which allowed us to move existing code over by mapping existing inputs and outputs into the unit testing framework. Unit testing personally bores me as a programmer, but it's an awesome tool for going from "version 0.1" to "version 1.0" of a project.

Most of the bigger frameworks I've used (Zend and Symfony) have easy ways to include custom javascript into their views -- either in library form or inline in the views. I don't think that should be a concern.

The bigger question is if you pause development to roll your features into a framework, or if you should try to integrate pieces of the framework as you go. I've never seen the former work well; it gets boring (to me). The latter does not work well with Symfony but works great with Zend.

share|improve this answer
Based on your experience with projects in a similar situation, what advice would you give the OP? Were there problems with the rewrites you did? Would you have changed anything in hindsight? – Adam Sep 27 '11 at 21:04

Most of the time the perception of an extra "burden" or overhead to using a web framework deals with the added time needed to learn the framework. But we cannot tell what your friend really means by "starting clean". Is he simply against black-box solutions?

So many PHP frameworks use the MVC pattern, which leaves you with a lot of options. The time needed to research and experiment with the most popular to see which fits your needs better often would preobably be less of a cost than the time needed to roll your own. At least then you can have a better idea of whether your proposed features would really need a custom framework or not.

share|improve this answer
they are against black box solutions, and they claim that it is a little bit harder for us to use javascript with frameworks – LostMohican Sep 27 '11 at 21:55
Do they wish to load the Javascript from controllers or put it directly in the views? – JustChris Sep 28 '11 at 16:02

When you can answer YES to any of this questions:

  • It will take a greater effort for you to stay on your path, than to go back and change frameworks.
  • You realize your current implementation does not support a required feature you can't do without.
  • It is more cost effective to go back and change than to keep on the current path. (Similar to the first.)
  • You do not have a delivery date and you just want to try out something different.

When should you NOT do it:

  • When you'll miss a delivery date because of the change. What to do: Deliver it how you planned, then change it. It might be more costly to go back and miss a delivery date, than just to change it later and make it version 2.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.