Aksel Gresvig/@agresvig - Accenture - JavaZone '14
I talk about frontend architecture because this is my main domain
But the principles discussed apply to software architecture in general
To solve problems
..is tiresome.
do what they've done before because we're are comfortable with it
think new stuff is scary stuff
think repetition is easier than innovation
Photo: generalunitedindustries.com
We do whatever everyone else is doing
AngularJS all over the scene? Must be good lets use it
Photo: Dariusz Paciorek/Getty
We believe the hype
Golden kid at last conference always gets attention
Fancy promo-site and API docs gets us (guilty!)
Photo: BRANKOPOPOVICBLOG
So how do we navigate the
and deal with our own
We ask the right
to find the right
What really matters is the
What should the software you are building do?
Who is the target user?
These are matters that always should take precedence
Lets look at webapps! After all, its what the majority of us are building these days
UX for your use case should be front and center when planning out the solution.
so
Lets consider some fundamentally different technical approaches
like
(Backbone, Angular, Ember, Knockout)
..vs
(JSP, Django, Ruby on Rails, Wicket, etc)
Server sends Javascript to client
-> execute on client
-> fetch data, render UI
WHY do this on a consumer device when we have peta-zeta datacenters that can do this for us?
Because partial rendering and UI animations provide a
There is a difference in nature between a
and a
Which one are you building?
pjax = pushState + ajax
pjax loads html from your server into the current page without a full page load
The idea is you can't tell the difference between pjax page loads and normal page loads.
But really it's just ajax and pushState.
On the client
My Site
Go to next page.
$(document).pjax('a', '#pjax-container')
On the server
def index
if request.headers['X-PJAX']
render :layout => false
end
end
Why is this cool?
Because its simple. Simple is good
It gives SPA feel with server-side benefits
it doesn't really scale to full-size web app development
The Holy Grail of webapp development?
Advancements in frontend tech. helps make it possible
Put common application logic in
JS modules and run them where it makes sense (server or client)
Examples
// Our component...
var HelloMessage = React.createClass({
render: function() {
return Hello {this.props.name};
}
});
// ...can be rendered to a string on the server...
React.renderComponentToString(HelloMessage({name: "John"}));
// ...then on the client, renderComponent will preserve
// the server-rendered markup & just attach event handlers
React.renderComponent(< HelloMessage name="John" />, mountNode);
I just vouched for the latest and greatest, yet-to-be tested in production, approach to building webapps.
Exactly this years JavaZone hype