Session at Oredev 2016.

65
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. 10 Awesome Tips for Enterprise JavaScript Geertjan Wielenga @geertjanw

Transcript of Session at Oredev 2016.

Page 1: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

10 Awesome Tips for Enterprise JavaScript

Geertjan Wielenga @geertjanw

Page 2: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 3: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

A metaphorfor our age!

The distractedsociety!

FacebookbeatsRembrandt!

(And the end of the worldis nigh.)

Page 4: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Actually...

They're usinga museum app.

And are findingout more aboutthe paintings theyhad been closelyfocused on a fewminutes earlier.

Page 5: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Browser platform Java platform

Page 6: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 7: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

10 Building Blocks of Enterprise JavaScript1. Resist the hype.

2. Rediscover HTML5 as an application framework.

3. Compare responsive design between CSS and JavaScript.

4. Evaluate the framework vs. library approach.

5. Incorporate modularity.

6. Evaluate abstractions over JavaScript, CSS, and HTML.

7. Don't worry about ecosystem volatility.

8. Reorientate around WONTA instead of WORA.

9. Evaluate corporate frameworks.

10. Reconsider JavaScript as assembly language.

Page 8: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

1. Resist the hype

Page 9: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 10: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

● Data heavy monitoring systems.

● Behind the firewallmanagement systems.

● Large resolutionrequirements.

● All the usersin the same room.

Page 11: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

1a. Consider supplementing with new devices

Page 12: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

● Mobile appto receive urgent notificationsfor air traffic controlers.

● Web appto display reportsfor upper management.

● And keep the main systemexactly as it has always beensince that's how it makes sense.

Page 13: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

2. Rediscover HTML5 as an application framework

Page 14: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 15: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

HTML5: Not Documents Only, Not Multimedia Only● Originally, HTML was designed

as a language for semanticallydescribing scientific documents.

● HTML5 is a response todemands for multimedia experiences(animations, games, movies, and audio).

● However, it also includes built-in application-development features.● Semantic markup: <article>, <header>● New input types: e-mail, URL, color.● New Intellisense/Auto Completion.● Validation attributes, 'required' and 'pattern'.

Page 16: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Principles of HTML5

● New features should be based on HTML, CSS, and JavaScript.

● Need for external plugins, e.g., Flash,should be reduced.

● Error handling should be easierthan previous versions.

● Scripting should be replacedby more markup.

● HTML5 should be device independent.

Page 17: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

<input id="country_name" name="mycountry" type="text" required list="country" />

<datalist id="country"> <option value="Afghanistan"> <option value="Albania"> <option value="Algeria"> <option value="Andorra"> <option value="Angola"></datalist>

Page 18: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Demos

Page 19: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

3. Compare responsive design between CSS and JavaScript

Page 20: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 21: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

CSS: Not Only Styling of Documents

● Originally, CSS was designedas a stylesheet language for describingthe look and feel of documents.

● Unlike previous versions, CSS3is modular: over 50 modulesmake up CSS3.

● “Media Query” is the most well known.● Tailer to different resolutions.● Enable responsive design.● But... also take a look at JavaScript for this.

Page 22: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

CSS: Maybe Less Effective Than JavaScript

● CSS3 Media Queriesshow/hide elements from the DOM.

● JavaScript librariesload/unload elements from the DOM.● Response.js:

http://responsejs.com● Foundation Interchange:

http://foundation.zurb.com

Page 23: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Demos

Page 24: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

4. Evaluate the framework vs. library approach

Page 25: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 26: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 27: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 28: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Different Libraries, Different Purposes• Application Frameworks & Libraries

Angular, Knockout, Backbone, Ext, React, Ember, and more• Component Libraries

JQuery UI, Sencha, PrimeFaces, and more• Module Systems

RequireJS, Browserfy, and more• Build Systems

Grunt, Gulp, Brunch, and more• Testing Frameworks

Protractor, Jasmine, Qunit, Karma, and more

Page 29: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Frameworkapproach:

Libraryapproach:

Page 30: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

5. Incorporate modularity

Page 31: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 32: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Modularity: Not Natively Built into JavaScript, Right Now

● Consider and compare available modularity solutions● Require.js:

http://requirejs.org/● Browserify:

http://browserify.org/● SystemJS● ECMAScript 6 Modules

Page 33: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Demos

Page 34: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

6. Evaluate abstractions overJavaScript, CSS, and HTML

Page 35: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 36: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

HTML: Emmet

JavaScript: TypeScript, CoffeeScript

CSS: SASS, LESS

Page 37: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

7. Don't worry about ecosystem volatility

Page 38: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 39: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Life in a Volatile Ecosystem

● Lifespan of your app equals lifespan of the framework you're using.● 1 ½ to 2 year lifespan.● Is the code hard to read, no worries, it'll be rewritten from scratch soon.● Don't worry so much about maintainability and backward compatibility.● Things change fast, the ecosystem is already different right now

than when this presentation started.

Page 40: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 41: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

8. Reorientate around WONTA instead of WORA

Page 42: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 43: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Write Once, Never Touch Again

Page 44: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

9. Evaluate corporate frameworks

Page 45: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 46: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Unexpected Organizations in Enterprise JavaScriptand open source software projects in general

● Microsoft – several● IBM – several● SalesForce – several● SAP – SAP UI5 and Fiori● ING – github.com/Spectingular (AngularJS-based component framework.)● PayPal – krakenjs.com (Node.js/Express based application framework.)● Oracle – oraclejet.org (Toolkit of open source JavaScript libraries.)

Page 47: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 48: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 49: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Requirements First• Responsive Design• Modularity• Single Page Application• Accessibility• Internationalization• Security & Performance Optimization• Conformance to Standards• Documentation & Support

Page 50: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Oracle JET: Free & Open Source Enterprise JavaScriptOracle JavaScript Extension Toolkit

• oraclejet.org, @oraclejet, github.com/oracle/oraclejet• Not a framework, not a library, but a toolkit• Collection of open source libraries, e.g., Require, Knockout, JQuery• Free and open source component library (Graphs, Charts, etc)• Architecture and templates and enterprise solutions, e.g., accessibility• Actively used within Oracle, since about 3 years

Page 51: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 52: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Twitter: @oraclejet

Page 53: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Twitter: @oraclejet

Page 54: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Twitter: @oraclejet

Page 55: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 56: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 57: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Oracle JET: Free & Open Source Enterprise JavaScriptOracle JavaScript Extension Toolkit

• oraclejet.org, @oraclejet, github.com/oracle/oraclejet• Not a framework, not a library, but a toolkit• Collection of open source libraries, e.g., Require, Knockout, JQuery• Free and open source component library (Graphs, Charts, etc)• Architecture and templates and enterprise solutions, e.g., accessibility• Actively used within Oracle, since about 3 years

Page 58: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

10. Reconsider JavaScript as assembly language

Page 59: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 60: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Page 61: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Write in Java – Let Framework Create JavaScript

● https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js● Vaadin: http://vaadin.com● DukeScript: http://dukescript.com

● Framework for creating applications for all devices from single codebase.● Plain Java applications that internally use JavaScript and HTML.● Business logic in Java and view in HTML.● Maven archetypes in Maven central.

Page 62: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Write in Java – Let Framework Create JavaScript

Page 63: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Write in Java – Let Framework Create JavaScript

Page 64: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

10 Building Blocks of Enterprise JavaScript1. Resist the hype.

2. Rediscover HTML5 as an application framework.

3. Compare responsive design between CSS and JavaScript.

4. Evaluate the framework vs. library approach.

5. Incorporate modularity.

6. Evaluate abstractions over JavaScript, CSS, and HTML.

7. Don't worry about ecosystem volatility.

8. Reorientate around WONTA instead of WORA.

9. Evaluate corporate frameworks.

10. Reconsider JavaScript as assembly language.

Page 65: Session at Oredev 2016.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Contact Details

@geertjanw

@oraclejet

[email protected]

blogs.oracle.com/geertjan