1

Possible Duplicate:
When do I need to use a framework?

I feel fairly competent at creating a number of applications in PHP and thus far have not seen the need to use one of the popular frameworks (CakePHP, Zend, etc).

As a programmer it gives me comfort to know exactly what my code is doing and I suppose before now that has made sense since I've been learning the language.

Is it ignorant of me to not want to use one of these mainstream frameworks? Will it hurt my productivity? Why should I not just create me own code base that makes sense for me?

Other than possibly hindering later career choices where many roles might require framework experience, I'm not sure I'm missing out...

Anonymous
  • 3,546
  • 2
  • 25
  • 26

5 Answers5

5

Refusing to use frameworks isn't always a bad idea. However, at the same time I'd question if you are using your own web server software, PHP compiler or interpreter, and other tools so that you really know exactly what your code is doing as otherwise you are relying on other tools which is what a framework gives.

Be careful of approaching arrogance in terms of how you view those frameworks. If you haven't thought about or even seen the frameworks, then you may have a prejudicial view that is worth remedying I'd consider. While it may be nice to optimize your productivity, are you really prepared to have to create some set of metrics and experiments to determine what is and isn't working in your life?

JB King
  • 16,795
  • 1
  • 40
  • 76
4

In this case it takes longer to develop something than to understand how something works.

If you want to know how things work, you can just read source code. On top of that, frameworks usually address some esoteric problems which you're probably unaware of in your personal code. And even if you are, the framework developers are committed to fixing any peculiarity that ever comes up, and fixing it well and tested.

Learn to use popular frameworks. Learn how they work inside and why. It'll only do you good.

Yam Marcovic
  • 9,270
  • 2
  • 27
  • 29
2

The only reasonable thing I could weigh in as being an advantage of writing your own is the knowledge gained in the experience. Reading a framework's source and writing your own are two entirely different experiences. Even in that situation though, it still comes down to how much you are willing to ignore pre-existing constructs and standards. I say reasonable, because there is the off chance that you might be a genius, or lucky, and come up with something amazing through your self imposed limits on influence. Your inventive potential stands to gain much from ignoring the status quo, should you even take it that far.

As for why you shouldn't just make something that makes sense to you, well: what if you spent some time making some pre-existing framework make sense to you? Could you perhaps save time in the long run, compared to your doing your own thing? Or if time isn't your concern, then insert whatever it is you are trying to get out of this into that question and think long and hard.

Basically, if writing your own framework is something you're seriously considering, you stand to become intimately familiar w/the material which is good if you are specializing in the field. If you feel your ingenuity is resilient enough to not miss out on any great ideas by immersing yourself in extant APIs. Alternatively, if you are unsure of your actual familiarity with a subject in the face of everything that is out there, taking Cake for a spin might do you a world of good and give you more ideas than you'd come up w/otherwise. Perhaps you may find that you can even improve upon one that already suits your tastes. :)

Kreychek
  • 186
  • 5
  • There are a lot of good answers to my question, but this one stands out as being the most helpful to me, so I'm gonna go ahead and mark it as correct - thanks Kreychek. – Anonymous Nov 22 '11 at 15:29
1

Can you create your own code that is as feature-rich and extendable as your client wants, in the allotted time frame? If so, then go for it! But other developers who make use of frameworks may have an edge over you when they can get their systems built and running faster than you.

Also, if you decide one day to apply for a PHP job that uses some popular framework, which you have no related experience in (in the same framework or even a similar framework), it may hurt your chances of getting the job, if your equal to the other candidates in all other areas.

I agree with you that sometimes it's discomforting to not really know what's happening "under the hood", but honestly, there isn't always the time to build everything from scratch (fun though it may be).

FrustratedWithFormsDesigner
  • 46,105
  • 7
  • 126
  • 176
1

If you aim for a clean codebase, you will have a framework. The only choice you can make is whether you want to develop (and maintain) your own framework, or whether you want to piggy-back on top of someone else's framework.

This is a set of problems that frameworks typically solve, and that you will end up solving yourself if you decide to build your own:

  • MVC separation of code, templating layer
  • Security best practices (avoiding SQL injection, mail header injection, character encoding issues, CSRF, XSS, session fixation, ...)
  • Unicode compatibility, translation
  • DB abstraction layer, cross-DB compatibility
  • Output caching for improved performance

From that perspective, a framework can save you a lot of time. But you should still understand how they solve all those problems.

Joeri Sebrechts
  • 12,922
  • 3
  • 29
  • 39