KEMBAR78
Modern Web Application Development Workflow - EclipseCon US 2014 | PDF
MODERN
WEB APPLICATION
DEVELOPMENT
WORKFLOW
FIRST, LETโ€™S LOOK
AT THE PAST
HOW WEB
APPLICATIONS
USED TO BE DONE?
THROW A BUNCH OF HTMLFILES
THROW A BUNCH OF HTMLFILES
ADD A COUPLE OF CSSFILES
THROW A BUNCH OF HTMLFILES
ADD A COUPLE OF CSSFILES
PUT SOME JAVASCRIPTIN ALL THIS
THROW A BUNCH OF HTMLFILES
ADD A COUPLE OF CSSFILES
PUT SOME JAVASCRIPTIN ALL THIS
AND CALL IT A DAY...
COME BACK 6MONTHS LATER
AND TRY TO REMEMBER HOW TO
MAINTAIN YOUR CODE
MOVING
FORWARD
A NODE.JS WORLD
Node.js
โ‰ 
Server-side JavaScript
Node.js
stand alone JavaScript runtime
Node.js
stand alone JavaScript applications
Node.js
stand alone JavaScript applications
created by JavaScript developers
Node.js
stand alone JavaScript applications
created by JavaScript developers
for JavaScript developers
BRAND NEW WORLD
JAVASCRIPT
DEVELOPMENT
TOOLS
JAVASCRIPT
DEVELOPMENT
WORKFLOW
A GOOD
DEVELOPMENT
WORKFLOW
-HELPS YOU GET STARTED
A GOOD
DEVELOPMENT
WORKFLOW
-HELPS YOU GET STARTED
-MAINTAINS YOUR DEPENDENCIES
A GOOD
DEVELOPMENT
WORKFLOW
-HELPS YOU GET STARTED
-MAINTAINS YOUR DEPENDENCIES
-ENFORCES BEST PRACTICES
A GOOD
DEVELOPMENT
WORKFLOW
-HELPS YOU GET STARTED
-MAINTAINS YOUR DEPENDENCIES
-ENFORCES BEST PRACTICES
-PREPARES YOUR TOOLS
A GOOD
DEVELOPMENT
WORKFLOW
-HELPS YOU GET STARTED
-MAINTAINS YOUR DEPENDENCIES
-ENFORCES BEST PRACTICES
-PREPARES YOUR TOOLS
-FIGHTS REGRESSIONS
A GOOD
DEVELOPMENT
WORKFLOW
-HELPS YOU GET STARTED
-MAINTAINS YOUR DEPENDENCIES
-ENFORCES BEST PRACTICES
-PREPARES YOUR TOOLS
-FIGHTS REGRESSIONS
-EASES THE RELEASE PROCESS
HOW TO GET STARTED?
YEOMAN
Born in 2012
Various contributors (Employees from
Google, Twitter, etc)
YEOMAN scaffolding
- structure
- compilation
- static analysis
- dependencies management
- development tools
- unit testing
YEOMAN download
> npm install -g yo
โ€œ-gโ€ global install
YEOMAN
Various generators:
โ—‹ Angular
โ—‹ Ember
โ—‹ Backbone
And all the other popular frameworks...
YEOMANbootstrapping
You can also use Yeoman to generate an
Yeoman generator project
YEOMANangular.js generator
> npm install -g generator-angular
YEOMANcreate an Angular project
> yo angular
YEOMANselect some dependencies
YEOMANchoose some options
YEOMANit creates the project
YEOMANit downloads the internet
YEOMANit uses some dark magic
Enjoy the view, Yeoman takes care of
everythingโ€ฆ
What does the result look like?
STRUCTURE
CONTENT
DEPENDENCIES
DEV TOOLS
YEOMANevolution over time
> yo angular:controller myController
create the code and its unit test
ITโ€™S MAGIC!
and it will be your job to maintain it...
HAPPY?
BUT HOW DOES IT WORK?
YEOMAN HAS FRIENDS
BOWER
GRUNT
GULP
AND
OTHERS
DEPENDENCIES
MANAGEMENT
BOWER
BOWER
Package manager for the web
Born in 2012
Created by Twitter and other contributors
over time
BOWER Download
> npm install -g bower
BOWER Find a package
> bower search jquery
BOWER Find the versions available
> bower info jquery
BOWER Add a specific dependency
> bower install jquery#1.10.2 --save
install jquery and save this new dependency
BOWER
runtime dependencies in bower.json
DEPENDENCIES
LOCATION
BOWER Add all your dependencies
> bower install
BOWER See your dependencies
> bower list
BOWER
Package management always comes with its
set of problems:
BOWER
Package management always comes with its
set of problems:
- how can I create a new package?
BOWER
Package management always comes with its
set of problems:
- how can I create a new package?
- how can I host a bower repository?
BOWER
Package management always comes with its
set of problems:
- how can I create a new package?
- how can I host a bower repository?
- what kind of exotic tools will I have to use?
BOWER Create a bower package
> bower init
BOWER Host a bower repository
BOWER Host a bower repository
> git init
BOWER Host a bower repository
> git init
> git add .
BOWER Host a bower repository
> git init
> git add .
> git commit -m โ€œInitial commit.โ€
BOWER Host a bower repository
> git init
> git add .
> git commit -m โ€œInitial commit.โ€
> git remote add origin โ€ฆ
BOWER Host a bower repository
> git init
> git add .
> git commit -m โ€œInitial commit.โ€
> git remote add origin โ€ฆ
> git push origin master
BOWER Host a bower repository
SVN support has been added with bower 1.3
for those who careโ€ฆ.
BOWER Use bower with Git
> bower install https://myrepository.git
BOWER Host multiple versions
> git tag -a 1.4 -m 'version 1.4'
> bower install https://myrepository.git#1.4
BOWER Host multiple versions
Use semantic versioning to easily let your
consumers handle API breakages
BOWER Download
> bower install jquery
> bower install git://github.com/jquery/jquery.git
BOWER Download
> bower install jquery
> bower install git://github.com/jquery/jquery.git
How do this work?
BOWER Registry
https://github.com/bower/registry
A simple web server listing Git repository URLs
BOWER Register
> bower register myrepository https://โ€ฆgit
> bower install myrepository
BUILD
GRUNT GULP
CONFIGURATION
GULP
CODE
GRUNT
EQUALLY
POWERFUL
GRUNT is a bit older so its
ECOSYSTEM is more mature
Grunt and Gulp
development tools dependencies in package.json
>npm install
DEV TOOLS
GRUNT
GRUNT
Configuration in Gruntfile.js
GRUNTgruntfile.js structure
3 parts:
-Task loading
-Task configuration
-Task registration
GRUNT
An example: Static code analysis with JSHINT
GRUNT
HOW DO YOU USE IT?
>grunt
>grunt jshint:all
GULP
GULP
Configuration in Gulpfile.js
GULPgulpfile.js structure
3 parts:
- task loading
- task configuration
- task registration
GULP
GULP launch
> gulp
SOUNDS
FAMILIAR?
GULPdifferences with Grunt
node.js streams (asynchronous by nature)
nice and simple api
concurrent execution with Orchestrator
BUILD TASKS
STATIC ANALYSIS
grunt-contrib-jshint
gulp-jshint
Detect coding errors in your JavaScript files
(Checkstyle-like reports)
RESPONSIVE IMAGES
grunt-responsive-images
gulp-responsive-images
Produce images at different sizes for responsive
websites
COMPRESS IMAGES
grunt-contrib-imagemin
gulp-imagemin
Compress and optimize images
COFFEESCRIPT
grunt-contrib-coffee
gulp-coffee
Compile CoffeeScript source code to JavaScript
SASS
grunt-contrib-sass
gulp-sass
Compile SASS to CSS
WHY SASS?
- import
- extends
- function
- mixins
- variables
- compilation errors
MINIFICATION
grunt-contrib-uglify
gulp-uglify
Reduce the size of JavaScript files
CSS TRIMMING
grunt-uncss
gulp-uncss-task
Remove unused CSS rules
TESTING
TESTING
Frameworks: Jasmine, Mocha, QUnit
Runner: Karma
Code Coverage: Istanbul
TESTING
Hudson/Jenkins integration?
karma-junit-reporter
karma-coverage (Cobertura reports)
CHROME
DEVTOOLS
WORKSPACE
SNIPPETS
AUDITS
TIMELINE
REMOTE
DEBUGGING
DEMONSTRATION
Murphyโ€™s Law: Anything that can go
wrong โ€” will go wrong
BACKUP SLIDES
(if everything failed, you still
have some pictures)
KARMA + GRUNT/GULP
Test your application on
various devices
TO SUM UP
YEOMAN + BOWER + GRUNT/GULP
and their pluginsโ€ฆ
=
AWESOME
QUESTIONS?
THANKS!
Stรฉphane Bรฉgaudeau
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
The research leading to these results has received funding from the European Unionโ€™s Seventh Framework Program (FP7/2007-2013) for CRYSTAL โ€“ Critical System
Engineering Acceleration Joint Undertaking under grant agreement โ„– 332830 and from specific national programs and/or funding authorities.

Modern Web Application Development Workflow - EclipseCon US 2014