Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Front End Development for Back End Developers -...

Front End Development for Back End Developers - vJUG24 2017

Are you a backend developer that’s being pushed into front-end development? Are you frustrated with all JavaScript frameworks and build tools you have to learn to be a good UI developer? If so, this session is for you! We’ll explore the tools for frontend development and frameworks too!

YouTube: https://www.youtube.com/watch?v=U27mjVrmwEM

Matt Raible

October 25, 2017
Tweet

More Decks by Matt Raible

Other Decks in Programming

Transcript

  1. Blogger on raibledesigns.com Web Developer and Java Champion Father, Skier,

    Mountain Biker, Whitewater Rafter Open Source Connoisseur Who is Matt Raible? Bus Lover Okta Developer Advocate
  2. OAuth 2.0 Overview Today’s Agenda JavaScript / TypeScript Build Tools

    JavaScript Frameworks CSS Progressive Web Apps JHipster
  3. TypeScript $ npm install -g typescript function greeter(person: string) {


    return "Hello, " + person;
 }
 
 var user = "Jane User";
 
 document.body.innerHTML = greeter(user); $ tsc greeter.ts https://www.typescriptlang.org/docs/tutorial.html
  4. “Node.js is a JavaScript runtime built on Chrome's V8 JavaScript

    engine. Node.js uses an event-driven, non- blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.” https://nodejs.org https://github.com/creationix/nvm
  5. Front End Build Tools Old School: Gulp New School: SystemJS

    Hip: Webpack Web Dependencies: Old School: Bower New School: npm Hip: yarn
  6. Yeoman The web's scaffolding tool for modern webapps Helps you

    kickstart new projects Promotes the Yeoman workflow yeoman.io
  7. Write and Bundle // bar.js export default function bar() {

    // code here } // app.js import bar from './bar'; bar(); // webpack.config.js module.exports = { entry: './app.js', output: { filename: 'bundle.js' } } <!-- index.html --> <html> <head> ... </head> <body> ... <script src="bundle.js"></script> </body> </html>
  8. webpack.config.js module.exports = { entry: './src/app.js', output: { path: __dirname

    + '/src/main/webapp/public', filename: 'bundle.js' }, module: { loaders: [ { test: /.js$/, loader: 'babel', exclude: /node_modules/, query: { presets: ['es2015', 'react'] } } ] } };
  9. @spring_io #springio17 Jobs on Indeed October 2017 0 2,000 4,000

    6,000 8,000 Angular Backbone Ember Knockout Polymer React Vue
  10. @spring_io #springio17 Stack Overflow Tags October 2017 0 20,000 40,000

    60,000 80,000 Angular Backbone Knockout Ember Polymer React Vue
  11. @spring_io #springio17 GitHub Stars October 0 20,000 40,000 60,000 80,000

    Angular Backbone Knockout Ember Polymer React Vue
  12. Hello World with Angular import { Component } from '@angular/core';

    @Component({ selector: 'my-app', template: `<h1>Hello {{name}}</h1>` }) export class AppComponent { name = 'World'; } <my-app></my-app> https://angular.io/guide/quickstart
  13. Hello World with Angular import { BrowserModule } from '@angular/platform-browser';

    import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FormsModule, HttpModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
  14. Hello World with Angular import { enableProdMode } from '@angular/core';

    import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; if (environment.production) { enableProdMode(); } platformBrowserDynamic().bootstrapModule(AppModule);
  15. ng-book 2 A comprehensive guide to developing with Angular 4

    Worth all your hard earned $$$ https://www.ng-book.com/2 “Thank you for the awesome book, it's the bible for Angular.” — Vijay Ganta
  16. Imperative Code if (count > 99) { if (!hasFire()) {

    addFire(); } } else { if (hasFire()) { removeFire(); } } if (count === 0) { if (hasBadge()) { removeBadge(); } return; } if (!hasBadge()) { addBadge(); } var countText = count > 99 ? "99+" : count.toString(); getBadge().setText(countText);
  17. Declarative Code if (count === 0) { return <div className="bell"/>;

    } else if (count <= 99) { return ( <div className="bell"> <span className="badge">{count}</span> </div> ); } else { return ( <div className="bell onFire"> <span className="badge">99+</span> </div> ); }
  18. Hello World with Vue.js https://jsfiddle.net/chrisvfritz/50wL7mdz/ <div id="app"> <p>{{ message }}</p>

    </div> <script> new Vue({ el: '#app', data: { message: 'Hello Vue.js!' } }); </script>
  19. Vue.js Code <script src="https://unpkg.com/vue/dist/vue.js"></script> <div id="app"> <button v-on:click="clickedButton()">Click here!</button> </div>

    <script> new Vue({ el: '#app', methods: { clickedButton: function(event) { console.log(event); alert("You clicked the button!"); } } }); </script>
  20. Cascading Style Sheets #app { background: #eee; } .blog-post {

    padding: 20px; } .blog-post > p:first { font-weight: 400; } img + span.caption { font-style: italic; }
  21. Sass: Syntactically Awesome Style Sheets #app { background: #eee; .blog-post

    { padding: 20px; > p:first { font-weight: 400; } img + span.caption { font-style: italic; } } } http://sass-lang.com
  22. CSS Framework Stars on GitHub October 2017 0 30,000 60,000

    90,000 120,000 Bootstrap Foundation Pure Skeleton Material Components
  23. Front End Performance Optimization Reduce HTTP Requests Gzip HTML, JavaScript,

    and CSS Far Future Expires Headers Code Minification Optimize Images
  24. HTTP/2 Binary, instead of textual Fully multiplexed, instead of ordered

    and blocking Can use one connection for parallelism Uses header compression to reduce overhead Allows servers to “push” responses proactively into client caches
  25. Mobile Hates You! How to fight back: Implement PRPL Get

    a ~$150-200 unlocked Android (e.g. Moto G4) Use chrome://inspect && chrome://inspect?tracing Lighthouse DevTools Network & CPU Throttling
  26. The PRPL Pattern Push critical resources for the initial URL

    route Render initial route Pre-cache remaining routes Lazy-load and create remaining routes on demand
  27. “Reusable UI widgets created using open web technology.” - MDN

    Web Components consists of four technologies: Custom Elements HTML Templates Shadow DOM HTML Imports Web Components https://www.polymer-project.org https://stenciljs.com https://www.webcomponents.org
  28. Security: OWASP Top 10 1. Injection 2. Broken Auth &

    Session Mgmt 3. Cross-Site Scripting (XSS) 4. Broken Access Control 5. Security Misconfiguration 6. Sensitive Data Exposure 7. Insufficient Attack Protection 8. Cross-Site Request Forgery 9. Components w/ Vulnerabilities 10. Underprotected APIs
  29. The JHipster Mini-Book Written with Asciidoctor Quick and to the

    point, 130 pages Developed a real world app: www.21-points.com Free Download from infoq.com/minibooks/jhipster-4-mini-book @jhipster_book
  30. What You Learned ES6 and TypeScript Node.js and nvm Angular,

    React, and Vue.js CSS and Sass Front End Performance Optimization Progressive Web Apps
  31. TRY

  32. Action! Don’t be afraid to try new things Learn JavaScript

    or TypeScript Try one of these frameworks Form your own opinions Or just wait a few months…