What exactly is a web framework?
Asked Answered
E

3

23

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?

Efface answered 27/7, 2010 at 15:58 Comment(1)
It sounds like you should be asking more about what is an MVC Architecture. Both Django and RoR are MVC frameworks. Understanding the role and purpose of using an MVC architecture will help answer your question. en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93ControllerIngrate
E
48

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.

Extemporary answered 27/7, 2010 at 16:28 Comment(0)
D
4

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.

Depress answered 27/7, 2010 at 16:2 Comment(0)
T
2

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.

Tandem answered 27/7, 2010 at 16:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.