summaryrefslogtreecommitdiff
path: root/wired/old/published/Webmonkey/Frameworks/intro.txt
blob: e28504e6eb67db840f03886df460720b814cb9c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
If you've built a few websites from scratch chances are you've noticed that you have to solve some of the same problems over and over again. Doing so is tiresome and violates one of the core tenants of good programming -- Don't Repeat Yourself (DRY).

Luckily for you other people long ago noticed that web developers face similar problems when building a new site. Sure, there are always edge cases which will vary from site to site, but for the most part there are four general tasks we developers have to handle -- Create, Read, Update and Delete, otherwise known as CRUD.

To help you out, a number of web application frameworks have emerged over the years. You might have heard of some of the more famous frameworks -- [http://www.rubyonrails.com/ Ruby on Rails], [http://www.cakephp.org/ CakePHP] and [http://www.djangoproject.com/ Django].

== What is a Web Framework? ==

A web framework is a software framework designed to simply your web development life. Frameworks exist to save you from having to re-invent the wheel and help alleviate some of the overhead when you're building a new site. Typically frameworks provide libraries for accessing a database, managing sessions and cookies, creating templates to display your HTML and in general, promote the reuse of code.

It's important not to confuse a framework with a content management system. While a framework deals with many of the same issues and, in some cases, may make it very easy to build a content management system, a framework is much more general.

In fact a framework isn't really anything at all. Think of a framework as a collection of tools, rather than a specific thing.

==What Can You Do With a Web Framework==

Frameworks exist to make building a website faster and easier. Typically frameworks provide  tools to cover the common CRUD cases. For instance you'll likely find libraries for accessing a database, managing sessions and cookies, creating templates to display your HTML pages and more.

Frameworks also promote the reuse of code. With a good framework you only need to design, for instance, a contact form once. Then you can drop your generic contact form code into all your projects and save yourself some time and effort.

Nearly any site you're going to build will have to interact with a database. Frameworks generally offer some means of doing so without having to delve into writing your own SQL every time you want to create, read, update or delete a record.

Similarly, most frameworks either provide a template system, or make it easy to add on your own templating system so that common chunks of HTML that rarely change, for instance, the header and footer of your page, need only be written once.

==How Do You Choose A Framework==

Although having a wide range of framework choices is definitely good, it can also be a source of confusion for inexperienced developers. With all of the possibilities out there, choosing one can be a daunting task the newcomer, so how do you decide?

That's something of a religious question, but a good place to start is to see if your favorite scripting language has a framework available. The Ruby in Ruby on Rails refers to the fact that Rails is a Ruby framework. So if you're a Ruby fan, Rails might be the framework for you, but there's also [http://www.nitroproject.org/ Nitro] and [http://www.merbivore.com/ Merb].

Python fans have a few to choose from. Django is fast becoming the Python framework of choice, but there are other options like [http://pylonshq.com/ Pylons] and [TurboGears http://turbogears.org/]. PHP lovers can check out [http://www.cakephp.org/ CakePHP], [http://www.symfony-project.org/ Symfony] and [http://framework.zend.com/ Zend]. There are also Perl and Java frameworks for those that enjoy Perl or Java.

However, just because there's a framework available in your favorite programming language doesn't mean it's the ideal choice. Each of the frameworks mentioned has its strengths and weaknesses and you'll have to evaluate each to see which is the best fit for your site's needs.

Although none of these should be the sole criteria, each of these frameworks are noted for certain things. 

For instance, Ruby on Rails offers tight integration with JavaScript, making it a popular choice for Ajax heavy sites. Ruby on Rails even includes the Prototype Javascript Library which you can integrate directly.

Django was developed for a very large newspaper website and offers a fantastic auto-generated site administration section for your site's users to create, edit and update content. It also includes built-in tools for caching data and building flexible URLs.

CakePHP borrows many conceptual ideas from Ruby on Rails but applies them to PHP. Given the widespread availability of PHP on shared web hosting servers, and the fact that Cake supports PHP4, it might be the most widely usable framework.

There are literally dozens, if not hundreds, of more web frameworks in all sorts of programming languages, but there just isn't room to cover them all. Perhaps the best way to choose a framework is to simply dive and and try building a site with each one. That way you can see which frameworks fits the best with your style and goals.

==Popular Frameworks==

**Note: I thought this section could just be a list on frameworks with link to the corresponding detail page in the webmonkey wiki.**

# [Ruby on Rails http://www.rubyonrails.com/] (Ruby) (Dive in with the webmonkey tutorial)
# [Django http://www.djangoproject.com/] (Python) (webmonkey intro)
# [Symfony http://www.symfony-project.org/] (PHP)
# [CakePHP v] (PHP)
# [Zend http://framework.zend.com/] (PHP)
# [Nitro http://www.nitroproject.org/] (Ruby)
# [Merb http://www.merbivore.com/] (Ruby)
# [Pylons http://pylonshq.com/] (Python)
# [TurboGears http://turbogears.org/] (Python)