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.

I am wondering if it is necessary to have a framework or if it is a must-have if I plan to make a large website. Large website could mean a lot of things: in other words, multiple dynamic web pages (40-50 dynamic pages, mysql content) and a lot of visitors (+- a million hits per month). The site will be hosted in a dedicated server environment.

I know that it could simplify coding for a developer team, that it includes libraries and a lot of advantages. But I just feel that I don't need that. I think that learning how it works, managing it and installing it would take more time and I could use that time to code.

I write PHP the simplest way I could (with performance in mind) and I try to reuse my code/functions/classes most of the time and I make sure that if another developer joins the team, that he won't be lost in the code.

I am also planning to use MemCached or another Cache for PHP.

As I said, the site will be hosted in a dedicated server environment but will be entirely managed by the hosting company. I am pretty sure the control panel for me to control the basic stuff will be Cpanel.

For a developer like me that only knows PHP, Javascript, HTML, CSS, MYSQL and really basic server management, I feel that it seems to complicated to have a framework. Am I wrong? Is it worth the time to learn all about it?

Thank you for your opinions and suggestions.

share

migration rejected from stackoverflow.com Aug 20 at 19:02

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as primarily opinion-based by gnat, Bart van Ingen Schenau, david.pfx, MichaelT, Dan Pichelman Aug 20 at 19:02

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

8  
No one needs a framework. At least not if it's for the sake of having one. Look at your project requirements. Then find out if there is a framework or a PEAR package that could help with solving that requirement. Pick the best one for the problem. That's the only sane approach. –  Gordon Apr 2 '11 at 15:02
    
Thank you all for your suggestions and comments. I really appreciate. –  Martin Apr 2 '11 at 15:27
    
If you haven't already invented a framework by doing tons of minor refactorings then you're doing something wrong. –  davidk01 Apr 2 '11 at 19:12
    
@davidk01 I think you're wrong. What if I have multiple projects and each with almost no overlap, what's wrong with not having a framework? (unless you mean framework as in what the app is running on). –  dkuntz2 Apr 18 '11 at 3:03
    
@DKuntz2: I don't think that's possible in web dev. Everybody deals with cookies, sessions, databases, etc. After a few projects everyone develops enough utilities in various libraries for dealing with the boilerplate and if you put it together in the right way then you get a framework. Unless of course you're completely oblivious to common recurring patterns in which case you can blissfully reinvent the wheel on every project. –  davidk01 Apr 18 '11 at 4:18

3 Answers 3

The question states

For a large website developed in PHP, is it necessary to have a framework?

And the answer is yes.

Why

The very existence of frameworks changed the development scene. Frameworks let you do mundane task fairly quickly, which leads to more time demanding clients and project managers. Not to mention code standardization and maintainability, among others.

The non framework way

Let's say for a moment that you need to develop a very, very large website using raw PHP. The first thing you would need to do is to define your project's directory structure. Next you start thinking about what features you would need: a database library, some kind of "utils" library, etc.

Many of these requirements will come on the fly. You'll start changing and moving stuff constantly until you're satisfied. How do we map URLs to controllers?, how do we map the models to the database? are some of the questions that will arise and will consume valuable development time.

You start coding and stuff starts to get complicated. In order to standardize your code (so you and your team don't collide with each other's work) you start creating your own inside rules. Unit testing comes into play and you realize your classes are a pain to test, so you start to refactor everything, once again.

By the time, 2 months have passed, you just made a framework from scratch and your project is far from finished. Stakeholders start to get anxious and the project manager start to get nervous. You get the idea.

The framework way

Rules are already defined. All you need to do is learn how to use this new framework. In a matter of 1 - 2 weeks (based on the time it took me to learn Django and Laravel) you're already able to tackle down your project. Everything's fluent, you don't need to worry about trivialities like URLs and ORMs.

Most of the frameworks are open source, they're endorsed by the community, so you don't need to worry about trivial (and often overlooked) security problems like XSS and CSFR. You're also ensuring your application will always be up-to-date with community standards and new practices.

Maintainability

Using a framework doesn't ensures maintainability, it promotes it. Unit testing, community defined rules, standards and structures are always a plus. If by any chance you need a new developer just ask HR for a senior or guru on X framework, that way you skip the overhead of explaining your inside monster of "on the fly" framework and just dig right in into your business logic.

Development Time

Large projects mean stakeholders and investors and that means time and money. They don't care about the application's performance or the milliseconds you save by not using a framework. All they care is results, results and money of course.

Competence

By using a framework you open a huge set of professional opportunities for yourself. What if your local "Google HQ" is looking for a senior Laravel developer? You suddenly realize how archaic your self-made framework is and how it can't compete with an "edgy" community driven development. Even worst, you spent a year working with a framework no one else except you or your company will use and you have no other option but to feel outdated.

That's all I can think of now.

share

If you have to write a MVC PHP app, then go ahead. If you just want using a framework to operate some array, mail, socket function, even it really save your time,it doesn't.

share
    
I want to agree with this, but I can't. If your app is some trivial one-off thing that you know 100% will never grow beyond that then by all means just hack it together. If you think the app will expand or need to be modified, then always use a framework so you can do things the right way from the start; anything less is dooming the app to be garbage for its lifetime because after the initial development you will likely never have the time to go back and fix the design errors. So +1 for sound advice, -1 for strong disagreement = 0. –  Wayne M Apr 18 '11 at 12:17

You'll end up with a framework whether you start with one or not. Eventually the time taken to write your own iteratively will exceed the time taken to learn one from outside, but at least then you'll have learnt something about the world.

Take a lesson from nature - every complex system has a framework, whether it's the bones in your body or the rules of accounting in the economy. The "framework pattern" is fundamental (and emergent) for any sufficiently complex system.

Or alternatively, don't have a framework, then find yourself copy-pasting a lot, then find your development times get slower and slower until you refactor everything into a framework...

share