开发者

How to write a web framework as a learning experience

开发者 https://www.devze.com 2023-01-13 13:54 出处:网络
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

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 rou开发者_如何学运维te 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".


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消