
What is a Web Framework? - mgrouchy
http://www.jeffknupp.com/blog/2014/03/03/what-is-a-web-framework/
======
ritchiea
I love stuff like this that talks about web basics in precise detail. Too much
of the stuff out there for beginners glosses over the basics of the web. In
the midst of receiving tons of info about HTML & CSS & Javascript & whatever
scripting language beginning devs have trouble knowing at all times what level
of the stack they are operating at, what's the execution context. Can I write
Javascript here? Can I write Ruby/Python? Does it have to be interpolated?
This stuff is seemingly simple but is actually so complicated when you're
thrown into the ocean that beginners have trouble keeping track of it.

And it really doesn't help when more experienced devs, or non-web programmers
shame people about web dev being dead simple because it's not. It's a
different kind of programming, it may even be easier than writing C and
managing memory explicitly and not having garbage collection. But if it is
easier, it's only easier once you've mastered it and have a really strong
grasp of what is happening at all times. Until you get there, it's easy to get
lost in the endless list of technologies you must be familiar with to write
even a simple web application. And I know this because I see it in beginners
that I have taught and/or worked with.

~~~
saturdayplace
I recently decided to write from some tutorials[1] (maybe eventually a book)
that assumes zero knowledge and works its way up. I'd like to eventually go
all the way up through SQL, basic httpd administation, etc. It's a long row to
hoe but I think it may be valuable.

[1] [http://trevorhunsaker.com/](http://trevorhunsaker.com/)

~~~
ctidd
I would strongly recommend reviewing your 101 WRT what you're calling tags and
clarifying that tags represent elements that are interpreted and rendered by
the browser. (The browser does not render tags.)

Also, the distinction of semantics and styling should be cleared up a little.
Less emphasis on how elements are styled by default, and more on what they
represent.

I like the approach of assuming no knowledge, but this requires extra care to
introduce concepts without using improper or misleading terminology. As a
beginner, there's not much worse than hearing simplifications and thinking
they're the whole story.

Good luck with continuing your series!

~~~
saturdayplace
Thanks for the feedback! I'll make sure to review for improper
simplifications.

------
blhack
I disagree with the sentiment of this blog post, because it implies (unless I
missed something) that you _need_ to use some complicated web framework to
make the internet go.

You don't, and I've recently been encountering a LOT of very confused would-be
devs who get stuck behind some tangled mess of django installation.

The "simplest" web application could look like this:

    
    
         #!/usr/bin/python
    
         import cgi
    
         form = cgi.FieldStorage()
         name = form.getvalue("name", none)
    
         print "content-type:text/plain\n"
         print "Your name is %s" % (name)
    
    

Or maybe you want to get fancy:

    
    
         #!/usr/bin/python
         import MySQLdb
         
         db=MySQLdb.connect(user=user,passwd=pass,db=test)
         c.execute("select something from sometable")
         results = c.fetchall()
    
         print "content-type:text/plain\n"
    
         #hey look, CSV data!
         for line in results:
              print ",".join(line)
    
    

etc. etc.

I encountered a dev the other day (I guess I'm a shitty dev, then?) who asked
me how my application handled URLs.

uhh...apache?

"No, how does it handle URLs, though"

"Apache. WTF are you talking about?"

"No, like if you go to example.com/foo/bar/, how does it know what to send
me?"

"...?"

I swear half the devs I meet lately are more concerned with javascript
frameworks and rewriting their own webserver than they are about actually
serving content to users.

Imagine a baker who was more concerned with building ovens than baking bread.

Keep in mind what your goals are when you're working: are you looking to write
a javascript framework, or are you looking to write a web application? Then
evaluate what path you want to take from "not having an application" to
"shipping a product".

Sometimes (probably many times), you don't need to make it as complicated as
you're making it, and apache will work just fine.

~~~
scarecrowbob
"Imagine a baker who was more concerned with building ovens than baking
bread."

I'd imagine that at some point, it's hard to make enough bread without
considering the ovens.

~~~
blhack
You're right.

But my point is that sometimes people get caught into pre-mature optimization.
The baker analogy, within the context of what I'm saying, is about a baker who
_never bakes any bread_ , because they spend all of their time iterating on
_ovens_ , and not _bread_.

Having some super fancy bread-making-machine is totally vital...eventually, or
if you're doing something very cutting-edge, or out of the ordinary.

But not when you're writing a personal blog.

~~~
scarecrowbob
Fair enough points; there is indeed a difference between being more concerned
about the ovens than the bread and all.

That said, I have worked with/for a lot of bakers who have literally given no
time thinking about the oven (I've done a lot of cheap PHP freelancing), and
occasionally ruminate on finding a better oven and the choice that led to my
current situation in the kitchen.

There are a fair number of folks out there who bake plenty of bread, but who
could do so in more sanitary conditions with easier to reproduce recipes if
they were open to some different methods.

I agree that a personal blog is probably not the right point for that kind of
methodology, but there are also a lot folks who need to learn the difference
between yeast and random fungii that they found by googling "free wordpress
themes".

------
interstitial
A framework is a weasel word for a Massively Coupled System. The trappings of
orthogonality and modularity are given lip service, while actually creating
some of the most anti-modular footprints in human systems design history.

~~~
burntsushi
I generally agree. But I think there exist _good_ "frameworks" out there. I'd
cite Bottle[1] as one. And while it's still new, I think Martini[2] has the
beginnings of something great. Both of them heavily rely on principles of
composition.

[1] - [http://bottlepy.org/](http://bottlepy.org/)

[2] -
[https://github.com/codegangsta/martini](https://github.com/codegangsta/martini)

~~~
interstitial
I agree, I think there is a movement afoot (if not named) that new frameworks
will be truly decoupled -- being designed by war-worn veterans. The first
frameworks were all massively coupled bells and whistles. The whole point of
RoR is a pseduo-OO skin over a massively coupled Active Record system that
can't really be extended without hula hoops. And Rails gurus love hula hoops.

~~~
mattgreenrocks
One problem: users of open source _love_ oodles of features, no matter how
useless. Witness the sheer number of people who admit the primary way they
choose a library is the _last commit date_ and features list.

So if you write a solid library with just the right number of features, then
it might get less consideration because you're not always duct-taping over
poor design choices.

This is what happens when we glorify Internet Time. It becomes more about
shipping and less about quality.

~~~
codegangsta
This is very true. It is a real issue in the open source world.
[http://github.com/codegangsta/martini](http://github.com/codegangsta/martini)
tries to pride itself on minimalism. Thankfully the modularity of the project
allows me to tell people to add features via other packages and repositories.
Even though the product is solid it is difficult to communicate that the
project is still active without having so many commits.

This is one of the reasons that I find the Golang package management
philosophy refreshing in theory. "Master should never break" really prevents
feature creep from coming in and promotes the use of solid packages that
aren't always being actively worked on. Of course there are some major
drawbacks wrt lack of versioning in Go, but I think the philosophy there
overall is a very good thing for open source development.

~~~
mattgreenrocks
Incredibly, people seem _receptive_ to overly ambitious feature-creep-laden
libraries even if they're completely half-baked. It's like they'd rather debug
someone else's code than write it properly in the first place. IMO, there's
few things more painful than when someone's library just _doesn 't_ work at
all. The 'shiny' factor of communities usually indicates a lack of respect for
good engineering. I much prefer communities that take coupling seriously; the
only one I've found so far seems to be Clojure.

Please continue to push Golang away from fashion-oriented 'engineering.' I
hope you take marketing seriously; it seems very possible for someone to
create the next ultra-coupled-hack-of-a-Go-framework to rile everyone up and
consequently forget all the lessons of minimalism.

~~~
Gigablah
Well, there's already Revel for that :)

------
blt
Cool post. I would be interested in a follow-up post about how web frameworks
handle user registration, authentication, and sessions.

~~~
est
and forms, file uploads, etc.

------
pacoverdi
I don't know if this qualifies as a framework as it is really minimal:
[http://jflask.net](http://jflask.net)

In short: java, inspired by flask, uses the http server included in the JRE.
Perfect for embedding a small webapp in a java program (jar size < 20k, no
external deps). Probably not suited for big scale apps.

Edit: homepage

------
jebblue
I wasn't able to open the article, it was hanging on a call to disqus.com and
I have that IP banned in my firewall (iptables):

[http://www.tcpiputils.com/browse/ip-
address](http://www.tcpiputils.com/browse/ip-address)

108.168.209.242

~~~
jknupp
Sorry, seems like Disqus was serving up spammy ads along with the comments.
I've disabled the ads.

~~~
jebblue
No worries, I want to read this after work, thanks for posting the
information. I'll edit/update with any feedback.

------
ZeroGravitas
The first two chapters of this online book cover similar ground, but for PHP
and the symfony framework:

[http://symfony.com/doc/current/book/index.html](http://symfony.com/doc/current/book/index.html)

------
bsaul
Part that took me the most time to understand is the different way to have an
execution context for dynamic pages ( cgi, wsgi, fastcgi, servlets). I think
that should definitely be a part of a "what is a web framework".

------
jebblue
I thought it was a good article, there are a lot of different programmers out
there, not all do web programming. This provides necessary coverage of the
core web stuff you need to know if you want to get into it.

------
jmgtan
Interesting discussion. Any thoughts on Spring and Spring MVC? Could Spring be
considered monolithic as well?

------
dorfuss
Thanks, you helped me a lot :) Does anyone know a similarly straightforward
article on TCP/IP?

~~~
simonw
Beej's guide to network programming is great
[http://beej.us/guide/bgnet/](http://beej.us/guide/bgnet/) \- it's pretty
deep, but it's very clearly written.

------
dfgeheht
It has been heartening to read so many of the comments here pointing how
absurd web development has become with the endlessly more rigid frameworks
prescribing their world view onto the developer, effectively reducing them to
module install muppets, rather than empowered developers.

~~~
mattgreenrocks
It's incredibly stifling once you get experience under your belt. FWIW, I
think Rails has a great design aesthetic, and yet it feels like a
straightjacket once I get near it. I want to just write Ruby.

------
the1
meh, no websockets?

~~~
pydanny
I would think that topic worthy of it's own blog post rather than a footnote
or a distraction.

~~~
vixen99
"its own ..."

------
daGrevis
Read all of the post.

I was expecting some enlightenment at the end or something useful for me, but
nothing. This stuff is mandatory for each and every programmer who writes web-
apps and I wouldn't call them web-programmers if they wouldn't know these
basics.

~~~
brickcap
Well I think the purpose was to teach people who are not web programmers. Or
at least those who are new to web programming.

