views:

39

answers:

1

I would like to write my own (toy?) web framework as a learning experience. I want to go through the whole process from scratch. I'd like it to be served through Apache on Linux. I'm looking for the best route to understanding every step of what is happening when using a web framework. I'd like to use whatever language best facilitates this process. What is the best way for me to go about this? By "best" I mean "results in the deepest understanding of everything that happens in a modern web framework".

+2  A: 

I am going to give a slightly tongue in cheek answer:

If I would start on this endeavour I would start with writing 3-5 web applications w/o framework support. Figure out what is always the same and factor that out. Refactor the applications to make use of it.

Then write some more web apps using your framework. Observe what you do over and over again. Factor that out and add it to your framework. Refactor the apps to see that your framework support works.

Repeat this and keep adding features till the framework becomes so large, complicated and unwieldy you just want to start over again. Then start over.

Now seriously, you are not going to learn how web frameworks work by writing a framework from scratch. You can only design frameworks when you have a pretty deep knowledge of the problem domain.

If you want to learn about what makes frameworks tick, do a couple of real projects in different frameworks/languages. See what works, feel what does not. Learn the design tradeoffs the framework developers have made. Try rails, jsf, seaside, lift, compojure, wicket, ... whatever.

Have fun and gain experience.

Peter Tillemans
I agree with you; knowing how to design a framework requires lots of experience 'doing' so to speak. But **writing** one doesn't, and seems like it would be instructive. How else will you learn details like 'How does a request get from Apache to your framework? And how does the response get back out?' etc
BioBuckyBall
Well, good luck!
Peter Tillemans