How to write a web framework
description
Transcript of How to write a web framework
About Ngoc• Came to Japan to study and work in 2001
• Studied electrical engineering at Takamatsu 高専 andcomputer vision at Tsukuba 大学
• Worked at several software startups:Murakumo (Kokolink), GNT, KAYAC, Mobilus
• Interests: web frameworks, distributed systems, realtime systems
• Have been writing some web frameworks since 20092 in Erlang, 1 in Scala, 1 in Java
• Open source:https://github.com/ngocdaothanh
• My favorite: Ruby on Rails
• It's a beautifulopinionatedconvention over configurationweb framework
https://gettingreal.37signals.com/ch04_Make_Opinionated_Software.php
Some people argue software should be agnostic. They say it's arrogant for developers to limit features or ignore feature requests. They say software should always be as flexible as possible.
We think that's bullshit. The best software has a vision. The best software takes sides. When someone uses software, they're not just looking for features, they're looking for an approach. They're looking for a vision. Decide what your vision is and run with it.
And remember, if they don't like your vision there are plenty of other visions out there for people. Don't go chasing people you'll never make happy.
• In my opinion
Library is about features
Framework is about workflow and connecting other existing libraries
• In my opinion,
Writing a framework is 10x harder than writing a library,
Because:- You need to know how to use and connect many libraries- You need to have much experience to have your vision, to make your framework opinionated
• Writing a library ~ Playing a music instrumentWriting a framework ~ Conducting an orchestra
Discussion question
• How market your web framework?How to let users know about and use it?How to create a community around it?
Discussion question
• What happens behind the scene
from the time when you type URL in the browser address bar and press ENTER
to the time the web page is displayed?
(Note: This is a Google interview question)
Discussion question
• What are the differences betweena command line program anda web program?
• What are the similarities between them?
Discussion question
• What are the features that you think a web framework should have? What are the things that you think a web framework should do for you?
• What is the most important part in a web framework?
• Request method + path info-> Router-> Which action to dispatch the request to
Routefrom request
to action
• Stacked handlers:
Request-> Handler 1-> Handler 2-> …-> Response
• Handler examples: router, dispatcher, static file server, response cacher etc.
Structure ofrequest processing pipeline
www.slideshare.net/ngocdaothanh/xitrum-scala-matsuri-tokyo-2014
• Sinetjahttps://github.com/sinetja/sinetja
• Xitrumhttp://xitrum-framework.github.io/
(Show how beautiful the APIs look like :D)
Demo