Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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...

share|improve this question

marked as duplicate by Anna Lear Nov 22 '11 at 15:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
You can learn a lot about programming from a framework; ignorance is not a point of a view. –  Jeremy Nov 22 '11 at 15:10
    
You should cure your NIH syndrome. –  deadalnix Nov 22 '11 at 15:28

5 Answers 5

up vote 2 down vote accepted

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. :)

share|improve this answer
    
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

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?

share|improve this answer
1  
Good insights. +1 –  Yam Marcovic Nov 22 '11 at 14:58

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.

share|improve this answer

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).

share|improve this answer

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.

share|improve this answer

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