views:

94

answers:

3

Is a web framework, such as Django and Ruby on Rails, simply a way of displaying code that could be written normally over http? Or is it used for more server side things, such as storing data. Is it used as a front-end or back-end for websites?

A: 

A web application framework is a software framework that is designed to support the development of dynamic websites, Web applications and Web services. The framework aims to alleviate the overhead associated with common activities performed in Web development.

Taken from this page.

Forlan07
I was looking more of answer in simple English. I have already read that and still do not understand.
Zonda333
And that's the reason why you voted the answer down?...
Forlan07
+3  A: 

A web framework is a programming environment that helps you build web sites and services. They are typically focused on server issues such as database connectivity, URL routing, HTTP protocol implementation, HTML generation, forms handling, and so on. Some will also help with client-side concerns such as helping your Javascript code work seamlessly with your server-side code.

Ned Batchelder
+5  A: 

Let's talk for a moment about things that aren't a web framework.

At the most basic level of the web you have a webpage. It's typically a dumb page with some text on it, maybe an embedded video or a few images. It doesn't (or at least ideally shouldn't) care where the stuff it displays is coming from. You don't need any scripts, databases, etc. in order to have a static webpage. Typical tools used: HTML, CSS, Javascript.

Then you have content management systems (CMS) such as, say, Wordpress. They add a bit more functionality to your site, but really all they do is provide you with a way to manage your collection of webpages -- create ones on the fly, etc. You can use them as is and interact with CMSs through the administration pages they provide. You can extend some of them (for example, Wordpress has a plugin architecture), but you're typically not concerned with how they work or with their specific API.

And then you have web frameworks. They allow you to do everything else in a structured manner. You don't need to have a framework to create a database-powered site, but it can help. Frameworks buy you a lot of convenience through convention. For example, if you want to add a new section to your site, you can create a "module", upload it to a known location, maybe update a config file, and it more or less wires itself into your site.

The framework is what can take care of your database details or pulling data in from other services (or providing data through a service). It can build pages for you automatically based on a template. It can take care of "prettifying" your links through URL routing. It can help you make sure none of your site links ever break -- by dynamically figuring out where pages are instead of you manually hardcoding links. They allow you to separate your back-end concerns (business logic, data access, authentication, etc) from your views, allowing you to easily update your page design if you feel like it.

To specifically address your questions...

  1. Web frameworks generate HTML pages served over HTTP. There's no particular magic here. You could often write the same pages yourself, but frameworks allow you to, for example, define a template and have a different page displayed based on your needs without your direct manual involvement.

  2. Web frameworks don't store data. They can access or provide it, but they aren't themselves a database of any kind. Web frameworks live on the server side and serve up pages to the client and process client's input.

  3. Frameworks like Django and Rails are used on the back-end. There are other frameworks like jQuery that can be used to script client-side activities, but they aren't web frameworks in the same sense. Usually when someone says "web framework", they mean server-side.

Hope this helps.

Anna Lear
Good explanation +10
Ed