Jump to content

framework?


bilis_money

Recommended Posts

ok, for those framework guru out there, could you share to me the advantages why a programmer should use  FRAMEWORK?

 

Could you give me a very good scenario for this.

 

an example of a case problem then a framework solution for the problem...  :D

 

Thank you very much in advance...  :D

Link to comment
Share on other sites

it's getting to be quite a common question, but the main advantage is (once you get over the learning curve) speed of development. frameworks generally provide many tools built in that take care of essential but mundane tasks (form validation, escaping input/output, querying databases, etc - the list goes on) allowing you to get on with the main job of building a site.

 

In a Model/View/Controller (MVC) framework, where the model generally looks after the DB, the view looks after the templates/HTML and the controller handles the pages, the Model is the biggest timesaver for me. Most cases where you query a database based on input go through several stages:

1, filter/validate the input to make sure it's suitable for the query

2, built the query SQL

3, run the query

 

all of which may take a good chunk of code EACH TIME you wish to run queries. not to mention that on more complex sites, you may need to construct quite complex SQL queries each time that deal with all sorts of table joins, etc. Potentially, a framework (in this example, CakePHP) can do the whole lot using 1 method depending on whether you fetching or saving data. The data is escaped to prevent injections and, in the event of a save, is also validated for you. In the event of a save failing, and providing you use the frameworks own tools for drawing forms and input boxes, etc, its very easy to present the user with a pre-filled in form with errors written out - all without having to do anything.

 

It's hard to outline all the pros/cons, but personally my pros (at least with CakePHP/MVC frameworks):

- speeds up development

- allows for easy changes in the future, even if the code isn't that well commented

- semi-forces you to organise things in a particular way, resulting in cleaner code/structure

- less bug fixing required each time

- many of the elements for one site (registration forms, contact forms, forums, etc) are easily used in another, due to the fact that everything other than the templates is quite unspecific to one particular site.

- make improvements to any part of your site or the framework itself without breaking other parts

Link to comment
Share on other sites

A framework also saves you from doing your application's/sites's core each time you start something new, which is IMO the most boring part. Another advantage is that large frameworks such as CakePHP is managed and developed by many people which means there are more people to spot (and fix) potential security issues. Frameworks are often optimized to speed as well and would probably take you some time to achieve the same speed as well if starting over again and again each time. Only the first one applies if it is your own personal framework though. Just my thoughts.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.