Why Use an Application Framework for Your Development Project?
When developing a website with substantial custom code I generally prefer to use an application framework instead of building everything from the ground up. Even other software developers might not be familiar with application frameworks, but those who have been programming for the web have at least come across mentions of CakePHP and Ruby on Rails. These exotic sounding terms are web application frameworks. Using a framework provides a number of compelling advantages.
What Is an Application Framework
An application framework is a programming environment which makes it easier for a developer to create a custom application. A framework provides both a pre-determined methodology and some powerful base functionality. Consider the difference between the task "create a vehicle to transport people and things" and the task "build a car given this frame, engine and transmission". In the second case you have a more narrowly focused objective and a lot of the hard work has been done for you. With an application framework some of the most difficult parts of the programming task are largely done for you - how to create, update and delete items from the database, how to structure your application logic and how to handle templating and display.
Advantages of a Framework
With a framework not only will you find a lot of the basics already done for you, you'll also find a lot of assistance in getting other common tasks done. It seems like every website that accepts and displays data of any kind will at some point need to sort that data and display it across multiple pages. Well, the framework will make pagination and sorting easy. You'll probably need to validate user input - require a user to enter an e-mail address for example - and it would be nice to give the user a friendly error message and retain the part of the form they did fill out. Web frameworks excel at this extremely common task. If you need your web application to work in multiple languages you can tap into the framework's internationalization support. Frameworks will also help out with sending e-mails and adding AJAX interactivity to your site.
Beyond the immediate advantages to the programmer are the advantages of using something that others are familiar with. If you're building something yourself from the ground up you're pretty much on your own. If you're using a framework there are forums and mailing lists of other users who can help. And when your company grows and you need to hire a new developer it's far more likely that she'll be familiar with CakePHP or Rail than with some in house system. The popular frameworks also have others developing modules you can use to extend the built in functionality.
Finally the framework can also assist in helping you keep things neat and maintainable. Every programmer has seen someone's sloppy code and knows how difficult it is to maintain. The structure provided by the framework encourages good programming practices and rewards you by making your job easier when you follow those practices.
Disadvantages of a Framework
The biggest disadvantage of using a framework is that there is a considerable learning curve. Don't be dissuaded though - You'll find that the time you invest in learning a framework will pay off greatly through increased productivity down the road. While working within a framework might seem restrictive at first, you'll find that you're able to do what you need and still abide by the conventions of your chosen system.
The next time you begin a project ask yourself if using a framework is right for you.