This document discusses how to avoid getting lost in the current JavaScript landscape. It begins by looking at modern web development trends like HTML5, CSS3, ES6, and expectations of fast page loads. It then examines traditional page lifecycles versus single page applications and various JavaScript frameworks. The document advocates for progressive enhancement and outlines strategies like "Hijax" and using the HTML5 History API to improve traditional approaches. It also discusses issues like code duplication, the benefits of isomorphic JavaScript, and tools for frontend development including Grunt, Gulp, asset bundlers, and test runners. It concludes by providing recommendations on technologies to adopt, consider, or stop using to develop with a progressive enhancement approach.
12. Feeling fast?
0 -100ms Instant Perception
100 - 300ms Small perceptible delay
300 -1000ms Machine is not working
1000+ ms Likely mental context switch
10000+ ms Task is abandoned
13. Permanent abandonment rate
People who never come back
- Outage 9%
- Slow performance 28%
source: Akamai: The impact of Web Performance on E-Retail Success
18. SPA Checklist
- do I need SEO?
- is your app behind a login?
- is my app content driven?
- learning curve
- frameworks
- do I need first page load performance?
- is my app small enough for SPA?
22. Cannot afford SPA?
Build your App with:
• Traditional Page Lifecycle model
• progressive enhancement
23. Fixing Traditional Page Lifecycle
problems
- Reloading entire pages when submitting
forms causes Flash of the content
- Apps are not interactive
- Feels slow
26. Hijax problems
- back button issue
- abuse of hashbangs: #!/no/more
- I like to share links to stuff I see
- can’t bookmark without proper url
We need proper URLs - why?
36. Need for tools
● No one likes writing plain CSS?
● Reduce boilerplate code
● Reduce manual work
● Sprites, fonts etc...
● Optimization, Website has to load super fast.
44. Grunt(trial)
Grunt is rapidly becoming the
de facto JavaScript build tool with high adoption and a
growing ecosystem.
While slower than newer alternatives, such as Gulp, in
terms of file processing,
Grunt covers a broader set of build-related activities,
has a proliferation of plugins and makes it easy to author
and publish self-written plugins to npm.
49. Fast incremental Builds
gulp.task('scripts', function () {
return gulp.src('src/**/*.js')
.pipe(cache('scripts'))
.pipe(header('(function () {'))
.pipe(footer('})();'))
.pipe(remember('scripts'))
.pipe(concat('app.js'))
.pipe(gulp.dest('public/'))
});
50. Gulp
In the last radar we called out Gulp as a strong competitor to Grunt,
with a clean API and fast builds thanks to its streaming approach.
...
We do see some teams successfully using Gulp inside Grunt, when the
speed of intermediate result caching is required, but we are not
recommending it as the default JavaScript build tool.
51. Gulp vs Grunt
- No intermediary files
- Fast builds
- Code over Configuration
- Streaming api
59. CommonJS
var thing1 = require('./thing1');
var thing2 = require('./thing2');
var thing3 = require('./thing3');
// Tell the module what to return/export
module.exports = function() {
console.log(thing1, thing2, thing3);
};
60. - CommonJS modules support
- First step to isomorphic JS
- works with dependency managers like npm
Webpack
Presentation structure:
Introduction and Summary
How do we build web apps nowadays
Current Web Development Landscape
SPA
Tools/Frameworks for SPA
Progressive Enhancement - Why do we still need it?
Tools/Frameworks for Progressive Enhancement
Making progressive enhancement more interactive
Isomorphic JavaScript
2) How to proceed with nodejs tools ecosystem
Start with yeoman
Build tools
Structuring your code
dependency management
Asset bundling
test runners
3) Building frontend tech stack, avoiding technology lock-in
4) Bridging nodejs and java
jhipster
similar to import in java
natively supported in nodejs
how about the support in the browser?
asking questions how is using what?
npm does everything that bower does plus more.
Lock-in means that a particular technology or product is dominant, not because its inherent cost is low or performance is good, but because it enjoys the benefits of increasing returns to scale.
Understand the techniques before choosing the tools
Build your tech incrementally
Avoid steep learning curve