Deep Dive into Web Architecture
next month we deep dive into various aspects of the web, starting
with a Web Architecture Day on Tuesday and continuing with a
works as an Agile Coach at Google, about web apps, the Angular project and
JAXenter: You are the creator of the Angular
open source project. Can you explain what you mean by the project’s
tagline: ‘what HTML would have been if it was designed for building
Miško Hevery: HTML was designed for sharing
documents on the web, and at that it has succeeded greatly.
Building web applications was really an afterthought, and it was
afterthought, shows up when you are trying to build a
web-application. Rather then telling the browser what you want,
often you have to say “how do I trick the browser to do what I
want”. This indirection causes extra levels of complexity. Angular
in a way acts as a polyfill or a shim to give the browser the
vocabulary which is useful for building web-applications.
JAXenter: In your opinion, what are the current
limitations of HTML, and how does Angular help overcome them?
Miško: Building web-applications without
angular is like building a building without scaffolding, it is
possible but harder. A lot of what a web-application code must do
is DOM manipulation to present the data to the user. DOM
manipulation code is around 80% of application code. Angular lets
you declare the way the internal state (model) is projected to the
DOM, which means that your application code can skip writing the
DOM manipulation code, and having to write 80% of code is a huge
saving. The result is that an application written with Angular is
significantly shorter, and as a result easier to maintain. But
Angular is also opinionated, and so it gives your application
structure, so that you don’t have to reinvent what is the best way
to build a web-application.
JAXenter: Who would benefit from attending your
JAXconf session, on Angular?
Miško: Angular’s sweet spot are CRUD
(create/read/update/delete) style applications. Luckily CRUD
applications represents most of the web-applications out there. If
you want to build an AJAX style (as opposed to round trip style)
web-application, which allows the user to view and edit data, then
Angular will allow you to get there faster.
JAXenter: You also created the remote
Miško: JSTestDriver, or JSTD as we like to call
it, was born out of the need to streamline the testing process.
When I write code I want all of my tests to run on every save. This
means that the tests must be fast, they need to execute on multiple
browsers simultaneously and they need to do so without any
interactions. Without JSTD, I would have to switch from my IDE to a
browser and hit the refresh button. Because each test would have a
separate HTML file running, all tests would take many seconds if
not minutes, and I could only run the tests on one browser at a
time. The context switch from the IDE to the browser to run the
tests, is too much, and it breaks the flow of development, and as a
result developers do not run their tests often enough.