Top Banner
ARCHITECTING FOR ENTERPRISE WITH JAVASCRIPT
140

Architecting for Enterprise with JavaScript

Jan 29, 2018

Download

Technology

Kurtis Kemple
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Architecting for Enterprise with JavaScript

ARCHITECTING FOR ENTERPRISE WITH JAVASCRIPT

Page 2: Architecting for Enterprise with JavaScript

Tech Lead @ MLS

: @kurtiskemple

: @kurtiskemple

: @kkemple

Page 3: Architecting for Enterprise with JavaScript

WHAT SHOULD I EXPECT?

Page 4: Architecting for Enterprise with JavaScript

BENEFITS OF USING JAVASCRIPT IN ENTERPRISE

Page 5: Architecting for Enterprise with JavaScript

SAME LANGUAGE ACROSS APPLICATIONS / PLATFORMS

Page 6: Architecting for Enterprise with JavaScript
Page 7: Architecting for Enterprise with JavaScript
Page 8: Architecting for Enterprise with JavaScript
Page 9: Architecting for Enterprise with JavaScript
Page 10: Architecting for Enterprise with JavaScript

INCREASED VELOCITY

Page 11: Architecting for Enterprise with JavaScript
Page 12: Architecting for Enterprise with JavaScript

NODE.JS AT PAYPAL - JAVASCRIPT VS JAVA

• Built the same application in almost half the time

• Written with 33% fewer lines of code

• Constructed with 40% fewer files

https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal

Page 13: Architecting for Enterprise with JavaScript

IMPROVED APPLICATION PERFORMANCE

Page 14: Architecting for Enterprise with JavaScript

https://strongloop.com/strongblog/node-js-is-faster-than-java

Page 15: Architecting for Enterprise with JavaScript

https://strongloop.com/strongblog/node-js-is-faster-than-java

Page 16: Architecting for Enterprise with JavaScript
Page 17: Architecting for Enterprise with JavaScript

https://www.youtube.com/watch?v=8aGhZQkoFbQ

Page 18: Architecting for Enterprise with JavaScript

LARGER ECOSYSTEM

Page 19: Architecting for Enterprise with JavaScript

http://www.modulecounts.com/

Page 20: Architecting for Enterprise with JavaScript
Page 21: Architecting for Enterprise with JavaScript

https://unpm.nodesource.com

Page 22: Architecting for Enterprise with JavaScript

LARGER TALENT POOL

Page 23: Architecting for Enterprise with JavaScript

http://stackoverflow.com/research/developer-survey-2016

Page 24: Architecting for Enterprise with JavaScript
Page 25: Architecting for Enterprise with JavaScript

BENEFITS OF JAVASCRIPT - RECAP

• Same Language Across Apps / Platforms

• Increased Velocity

• Improved Application Performance

• Larger Ecosystem

• Larger Talent Pool

Page 26: Architecting for Enterprise with JavaScript
Page 27: Architecting for Enterprise with JavaScript

COMMON TRAPS AND PITFALLS

Page 28: Architecting for Enterprise with JavaScript

VELOCITY IS THE MEASURE OF YOUR ABILITY TO ADAPT ”

“- Eric Elliot

https://ericelliottjs.com/product/tdd-es6-react/

Page 29: Architecting for Enterprise with JavaScript

MOVING TOO FAST

Page 30: Architecting for Enterprise with JavaScript
Page 31: Architecting for Enterprise with JavaScript

FRAGILE SYSTEMS

Page 32: Architecting for Enterprise with JavaScript
Page 33: Architecting for Enterprise with JavaScript

USING CLASSICAL INHERITANCE PATTERNS

Page 34: Architecting for Enterprise with JavaScript

WHY?

Page 36: Architecting for Enterprise with JavaScript

https://www.youtube.com/watch?v=lKCCZTUx0sI

Page 37: Architecting for Enterprise with JavaScript

COMMON ISSUES FACED WITH CLASSICAL INHERITANCE

• Tight Coupling

• Gorilla/Banana Problem

• Duplication By Necessity

Fluent 2013 - Eric Elliot, "Classical Inheritance is Obsolete"

Page 38: Architecting for Enterprise with JavaScript

INCONSISTENT CODE STYLES AND ARCHITECTURAL PATTERNS

Page 39: Architecting for Enterprise with JavaScript
Page 40: Architecting for Enterprise with JavaScript

ENTROPY

Page 41: Architecting for Enterprise with JavaScript
Page 42: Architecting for Enterprise with JavaScript
Page 43: Architecting for Enterprise with JavaScript

EVERYTHING IS NOT A NAIL

Page 44: Architecting for Enterprise with JavaScript
Page 45: Architecting for Enterprise with JavaScript
Page 46: Architecting for Enterprise with JavaScript

COMMON TRAPS AND PITFALLS - RECAP

• Moving Too Fast

• Fragile Systems

• Using Classical Inheritance (Deep)

• Inconsistent Code Styles / Architectural Patterns

• Entropy

• Everything Is Not A Nail

Page 47: Architecting for Enterprise with JavaScript

CODE QUALITY

Page 48: Architecting for Enterprise with JavaScript
Page 49: Architecting for Enterprise with JavaScript

WHAT MAKES QUALITY CODE?

Page 50: Architecting for Enterprise with JavaScript

F.I.R.S.T. PRINCIPLE

Page 51: Architecting for Enterprise with JavaScript

F.I.R.S.T. PRINCIPAL

• Focused

• Independent

• Reusable

• Small

• Testable

Page 52: Architecting for Enterprise with JavaScript

WHETHER IT’S A CLIENT OR SERVER-SIDE COMPONENT, A NODE MODULE OR A PIECE OF VISUAL UI, COMPONENTS THAT ARE LARGE ARE INHERENTLY MORE COMPLEX TO MAINTAIN THAN THOSE THAT ARE SMALL ”

- Addy Osmani

https://addyosmani.com/first

Page 53: Architecting for Enterprise with JavaScript

DISCOVERABLE

Page 54: Architecting for Enterprise with JavaScript

DISCOVERABILITY IS THE DEGREE TO WHICH YOU CAN FIGURE OUT HOW TO USE SOMETHING SIMPLY BY PLAYING WITH AND EXAMINING IT. ”

- Erik Dietrich

http://www.daedtech.com

Page 55: Architecting for Enterprise with JavaScript

HOW CAN WE MAKE CODE DISCOVERABLE?

Page 56: Architecting for Enterprise with JavaScript
Page 57: Architecting for Enterprise with JavaScript

HOW TO MAKE CODE DISCOVERABLE

• Documentation

• Tests

• Typing

• Declarative Naming Patterns

• Cohesive File Structure

Page 58: Architecting for Enterprise with JavaScript

SETTING STANDARDS

Page 59: Architecting for Enterprise with JavaScript
Page 60: Architecting for Enterprise with JavaScript
Page 61: Architecting for Enterprise with JavaScript

👍 👍

Page 62: Architecting for Enterprise with JavaScript

CODE QUALITY - RECAP

• Follow the F.I.R.S.T. Principal

• Code Should Be Discoverable

• It’s Important to Set and Enforce Standards

• PR’s Are a Great Way To Ensure Consistency

Page 63: Architecting for Enterprise with JavaScript

FINE TUNING YOUR ENVIRONMENT

Page 64: Architecting for Enterprise with JavaScript

VELOCITY IS THE MEASURE OF YOUR ABILITY TO ADAPT ”

“- Eric Elliot

https://ericelliottjs.com/product/tdd-es6-react/

Page 65: Architecting for Enterprise with JavaScript

UNIT TESTING

Page 66: Architecting for Enterprise with JavaScript

http://www.seguetech.com/the-benefits-of-unit-testing

Page 67: Architecting for Enterprise with JavaScript

WHAT DEFINES A UNIT?

Page 68: Architecting for Enterprise with JavaScript

AN INDIVIDUAL THING OR PERSON REGARDED AS SINGLE AND COMPLETE BUT WHICH CAN ALSO FORM AN INDIVIDUAL COMPONENT OF A LARGER OR MORE COMPLEX WHOLE ”

- The Dictionary

Page 69: Architecting for Enterprise with JavaScript
Page 70: Architecting for Enterprise with JavaScript

UNIT TESTING IS A SOFTWARE DEVELOPMENT PROCESS IN WHICH THE SMALLEST TESTABLE PARTS OF AN APPLICATION, CALLED UNITS, ARE INDIVIDUALLY AND INDEPENDENTLY SCRUTINIZED FOR PROPER OPERATION ”

http://searchsoftwarequality.techtarget.com/definition/unit-testing

- Tech Target

Page 71: Architecting for Enterprise with JavaScript
Page 72: Architecting for Enterprise with JavaScript

MEDIUMEST??

Page 73: Architecting for Enterprise with JavaScript

BLACK BOX TESTING

Page 74: Architecting for Enterprise with JavaScript

BLACK-BOX TESTING IS A METHOD OF SOFTWARE TESTING THAT EXAMINES THE FUNCTIONALITY OF AN APPLICATION WITHOUT PEERING INTO ITS INTERNAL STRUCTURES OR WORKINGS ”

Page 75: Architecting for Enterprise with JavaScript

THIS METHOD CAN BE APPLIED TO VIRTUALLY EVERY LEVEL OF SOFTWARE TESTING… ”“

https://en.wikipedia.org/wiki/Black-box_testing

- Wikipedia

Page 76: Architecting for Enterprise with JavaScript

Test Input

Unit

Success

Failure

Page 77: Architecting for Enterprise with JavaScript

CLOSING THE FEEDBACK LOOP

Page 78: Architecting for Enterprise with JavaScript

Page 79: Architecting for Enterprise with JavaScript
Page 80: Architecting for Enterprise with JavaScript

Page 81: Architecting for Enterprise with JavaScript

MANAGING DEPENDENCIES

Page 82: Architecting for Enterprise with JavaScript
Page 83: Architecting for Enterprise with JavaScript

PrivateRegistries

Yarn

Shrink Pack Rollup

DEPENDENCY MANAGEMENT STRATEGIES

Docker

Page 84: Architecting for Enterprise with JavaScript

#LEFTPAD

Page 85: Architecting for Enterprise with JavaScript

HANDLING ERRORS

Page 86: Architecting for Enterprise with JavaScript
Page 87: Architecting for Enterprise with JavaScript

PROCESS EVENTS TO HANDLE

• Uncaught Exception

• Unhandled Rejection

• SIGTERM

Page 89: Architecting for Enterprise with JavaScript

GETTING PREVENTATIVE

Page 90: Architecting for Enterprise with JavaScript

https://flowtype.org

Page 91: Architecting for Enterprise with JavaScript

SECURING YOUR RUNTIME

Page 92: Architecting for Enterprise with JavaScript

NODE LONG TERM SUPPORT VERSIONS

Page 93: Architecting for Enterprise with JavaScript

https://github.com/nodejs/LTS

Page 94: Architecting for Enterprise with JavaScript

https://nodesource.com/products/nsolid

Page 95: Architecting for Enterprise with JavaScript

N|SOLID FEATURES

• Package Vulnerability Monitoring

• 24 Hr Security Patch Integration

• Threshold and Process Monitoring

• Drop In Node Replacement

Page 96: Architecting for Enterprise with JavaScript
Page 97: Architecting for Enterprise with JavaScript

FINE TUNING YOUR ENVIRONMENT - RECAP

• Avoid Over Unit Testing

• Black Box Testing Can Help Solve Over Testing

• Closing the Feedback Loop Increases Velocity

• You Must Manage Your Dependencies

• You Must Handle Errors

• Securing Your Runtime Is Important

Page 98: Architecting for Enterprise with JavaScript

DEPLOYMENTS AND MONITORING

Page 99: Architecting for Enterprise with JavaScript

DEPLOYING WITH DOCKER

Page 100: Architecting for Enterprise with JavaScript

service:b01 STAGING

--tag prod

PROD

service:prod

Page 101: Architecting for Enterprise with JavaScript

DEPLOYING SANS DOCKER

Page 102: Architecting for Enterprise with JavaScript

https://zeit.co/now

Page 103: Architecting for Enterprise with JavaScript

DEPLOYING STATIC WEB APPS

Page 104: Architecting for Enterprise with JavaScript

https://surge.sh

Page 105: Architecting for Enterprise with JavaScript

https://pages.github.com

Page 106: Architecting for Enterprise with JavaScript

AUTOMATION IS 🔑

Page 107: Architecting for Enterprise with JavaScript

WOW! WE’RE IDENTICAL!

Page 108: Architecting for Enterprise with JavaScript

ENGINEERS

DELIVERABLES

Page 109: Architecting for Enterprise with JavaScript

MONITORING & CUSTOM METRICS

Page 110: Architecting for Enterprise with JavaScript

APPLICATION PERFORMANCE MONITORING

• Requests Per Minute

• Throughput

• Time Spent in Execution

Page 111: Architecting for Enterprise with JavaScript

https://newrelic.com

Page 112: Architecting for Enterprise with JavaScript

PROCESS MONITORING

• Memory Usage

• CPU Usage

• Network Usage

Page 113: Architecting for Enterprise with JavaScript

https://nodesource.com/products/nsolid

Page 114: Architecting for Enterprise with JavaScript
Page 115: Architecting for Enterprise with JavaScript
Page 116: Architecting for Enterprise with JavaScript
Page 117: Architecting for Enterprise with JavaScript

https://segment.com

Page 118: Architecting for Enterprise with JavaScript

DEPLOYMENTS AND MONITORING - RECAP

• Deploying with Docker Provides Application Versioning

• Now.sh is a Great Solution for Node Deployments

• Deploying Static Web Apps Is Easy Too

• Automation is Key

• Stated Is Great For Custom Metrics

• Segment Is Great For Business Analytics

Page 119: Architecting for Enterprise with JavaScript

MANAGING RELIABILITY

Page 120: Architecting for Enterprise with JavaScript
Page 121: Architecting for Enterprise with JavaScript

SERVICE LEVEL OBJECTIVES

Page 122: Architecting for Enterprise with JavaScript

A TARGET VALUE FOR A SERVICE LEVEL THAT IS MEASURED BY A GIVEN METRIC

- Site Reliability Engineering

http://shop.oreilly.com/product/0636920041528.do

Page 123: Architecting for Enterprise with JavaScript

BENEFITS OF SLOs

• Easily measurable

• Quickly identify regressions

• Easy to align with KPIs

• Provides clear improvement paths

Page 124: Architecting for Enterprise with JavaScript

EXAMPLES OF SLOs

• 99% Service Uptime per Quarter

• Able to Serve 1000 RPM

• < 500ms Response Times

• 100k Concurrent Connections

• < 1s To First Usable Render

Page 125: Architecting for Enterprise with JavaScript

ERROR LIMITS

Page 126: Architecting for Enterprise with JavaScript

EXAMPLES OF ERROR LIMITS

• 1% Service Downtime per Quarter

• < 900 RPM

• > 600ms Response Times

• < 90k Concurrent Connections

• > 1s To First Usable Render

Page 127: Architecting for Enterprise with JavaScript

MANAGING RISK - RECAP

• Managing Risk Allows You to Fine Tune Your Velocity

• Service Level Objectives Provide Goals for Systems

• Error Limits Are Used To Gauge Risk Introduced

Page 128: Architecting for Enterprise with JavaScript

CULTURE SHIFT

Page 129: Architecting for Enterprise with JavaScript

YOU CAN EITHER EMBRACE CHANGE OR YOU CAN BRACE FOR CHANGE ”

- Emily Webber

http://www.slideshare.net/turingfestival/emily-webber

Page 130: Architecting for Enterprise with JavaScript

FOSTER AN ENVIRONMENT OF LEARNING

Page 131: Architecting for Enterprise with JavaScript
Page 132: Architecting for Enterprise with JavaScript

POWER TO THE DEVELOPERS! 👊

Page 133: Architecting for Enterprise with JavaScript

https://www.youtube.com/watch?v=DGK6jjamzfY

Page 134: Architecting for Enterprise with JavaScript

EMPOWERING DEVELOPERS

• Purpose driven culture

• Whoever builds it, runs it

• From project to product

Page 135: Architecting for Enterprise with JavaScript

START SMALL

Page 136: Architecting for Enterprise with JavaScript
Page 137: Architecting for Enterprise with JavaScript

CULTURE SHIFT - RECAP

• You Must Embrace Change

• Foster An Environment of Learning

• Give Power to Your Developers

• Start Small

Page 138: Architecting for Enterprise with JavaScript

Q&A

Page 139: Architecting for Enterprise with JavaScript
Page 140: Architecting for Enterprise with JavaScript

ARCHITECTING FOR ENTERPRISE WITH JAVASCRIPT

: @kurtiskemple

: @kurtiskemple

: @kkemple