SlideShare a Scribd company logo
JavaScript for
Enterprise
Applications
Piyush Katariya
Software Architect, Red Panda Innovation Labs
● Pune● Mumbai
We are ...
We believe in meaningful iterations such as
...
We rely on ...
Why
( people rant / believe / think )
JavaScript sucks ?
Most like it Static and Strong
● Dynamic :
○ Duck typing (No help from Compiler)
○ Late binding (Runtime is the King)
○ Polymorphism by capability
● Weak :
○ Not agnostic about types while code
execution (Recipe for all disasters)
○ Allow weird operations ( [ ] + { } )
○ Implicit conversions ( “2” * “3” = 6 )
● Static typing does not mean that TDD/BDD
can be ignored
● Productivity due to
○ Duck typing
○ Map/JSON over concrete object
Other Accusations
My reply against Accusation for To reactions by Newbies
Yep it sucks. Use “yield” instead Callbacks WTF ???
Better syntax and error handling but use
“yield” instead
Promises Really ?? WTF ???
Corporate vs Open specification trade off
Are your requirements clear ?
Evaluate case by case basis.
Fragmented community at least
hundred options of libs and
frameworks for given task
What to choose ?
Why to choose ?
Why isn’t there a standard ?
Understand Concurrency vs Parallelism.
Little slower at computation but much
better at memory usage and IO
multiplexing than JVM/CLR.
No synchronization problems. period.
Single threaded and Slow Execution is slow because its
dynamic language !
What ? It does not have
multithreading support???
Atom, Visual Code, ESLint, TypeScript ? IDE, Compiler Basic and Refactoring support ?
Procedural, functional and event driven Multiple Paradigm confusion OO, Prototypal, functional, event ?
Paradigms and Disciplines
● Structured [ Edgar Dijkstra : Go To Statement Considered Harmful ]
○ Avoid “goto” statements
○ Embrace block structures, for/while loops and small functions/subroutines
● Object Oriented [ Simula and Simula-67 language]
○ Avoid pointer to functions
○ Embrace code reuse - Inheritance and (Parametric and Subtype) Polymorphism
● Functional [ John McCarthy : LISP ]
○ Avoid variables, use only constants (Referential Transparency)
○ Avoid mutation or IO side effects (or reduce it by wrapping it inside a Monad)
○ Embrace Higher Order functions, Recursion, Persistent data structures, CT
● Event Driven [CSP, Actor Model]
○ Avoid function/subroutine call by direct reference
○ Embrace communication between isolated components by generating an event
and registering callback function/subroutine
NodeJS Runtime
What they ignore (or less aware of)
➔ Application reload within milliseconds during development and deployment
➔ PM2 process manager for painless deployment and monitoring
➔ V8 engine performance
➔ Serving Tens of thousands of network connections with little memory overhead
➔ ES6 “yield” is here. ES7 “async” and “await” is not necessary
➔ Using Babel (transpiler) to emit ECMAScript 5 code
➔ RamdaJS and date-fp - functional replacement for collection and date API
➔ Programmable Module level polymorphism using CommonJS
➔ Isomorphism - Mobile devices, Browser, Server and NoSql DB query
➔ NodeJS Long Time Support - https://github.com/nodejs/LTS
ES6 Basics and Generators
ECMAScript 6
● No semicolons
● Fat arrows (with bind feature)
● Template strings
● let - control scoping
● const - control assignments
● Destructuring
● Generator
○ Lazy collections
○ Avoid callbacks
○ Avoid promise (use but not creation)
● for-of loop
All features :- http://es6-features.org/
Must Have ESLint and FP plugin
● eslint - Takes care of JS language quirks
● eslint_plugin_fp - JS as pure FP language
fp/no-arguments fp/no-mutating-methods
fp/no-class fp/no-mutation
fp/no-delete fp/no-nil
fp/no-events fp/no-proxy
fp/no-get-set fp/no-rest-parameters
fp/no-let fp/no-this
fp/no-loops fp/no-throw
fp/no-mutating-assign fp/no-unused-expression
no-var fp/no-valueof-field
Communicating
Sequential
Processes
C S P for Dummies
➔ Don't communicate by sharing state, share state by communicating
➔ Communicating
◆ Conversation over channel/queues/distributed queues
◆ Remote procedure calls
➔ Sequential
◆ Execution flow
➔ Processess
◆ Coroutines
◆ Green threads (scheduled by VM)
◆ Real threads (scheduled by OS)
◆ OS Process
◆ Machines
◆ Cluster of Machines
➔ Original Paper - http://usingcsp.com/cspbook.pdf
CSP vs Actor Model
CSP Actor Model
Process Identity Anonymous Concrete
Message Passing Synchronous Asynchronous
Communication Channels/Queues Direct
Composition NA Applicable
Fault Tolerance Easy to built with Distributed
Queue
Hierarchy of Local and
Distributed Supervisors
➔ Hybrid approach is also viable and more practical
RamdaJS
Data - Structure and Types
● Data is all we have
● Data is what we need to transform in order to create a user experience
○ Photoshop without the images is nothing
○ Word is nothing without the characters
● Instructions are data too
● Immutability matters
○ Value - Always Immutable
○ State - Snapshot. Value of something at certain point of time
○ Identity - Stable logical entity associated with a series of different values over time
○ Time - Relative term, not physically measurable
Computation - Function and HOF
● Higher Order Function (does either or both)
○ Accepts a function
○ Returns a function
● Higher order abstraction for
○ Computation
○ Combinators
○ DSL - Composition of computation and combinators
Thinking functionally
● Use function as first class citizen to build abstraction
● Avoid mutation of variable(memory pointer handle) and data (state)
● Chant this mantra every morning, “null is a billion dollar mistake”
● Favour recursion over iteration
● Procure laziness with Streams
● Use expressions over statements
● Composition over inheritance
● Many identical functions for few data structures than few different functions for many
data structures
RamdaJS HOF Abstraction
● Auto Currying
● Abstraction Categories
○ Object
○ Function
○ List
○ Math
○ Logic
○ Relation
○ Type
● Transducers
http://ramdajs.com/docs/
Server Side
Architecture
Software Architecture in a nutshell
“ In most successful software projects, the expert developers working
on that project have a shared understanding of the design.
This shared understanding is called ‘Architecture.’
This understanding includes how the system is divided into
components and how the components interact through interfaces.
These components are usually composed of smaller components, but
the architecture only includes the components and interfaces that
are understood by all the developers ”
- Martin Fowler
Abstraction and Indirection
“ The essence of abstractions is preserving information that is relevant in a given context,
and forgetting information that is irrelevant in that context ”
– John V. Guttag
“ In computer programming, indirection is the ability to reference something using a name,
reference, or container instead of the value itself ”
“ All problems in computer science can be solved by another level of indirection ….”
- David Wheeler
“ ….. except the problem of too many
layers of indirection ”
“ Making something easy to
change makes the overall
system a little more complex,
and making everything easy to
change makes the entire system
very complex.
Complexity is what makes
software hard to change “
Scaling with MicroServices
Architecture decisions starts with
“ Optimism is an occupational hazard of programming;
feedback is the treatment. ”
- Kent Beck
● Initial market research for given Business Domain
● Security
● Transaction capability and boundaries
● Online active users growth - total vs active vs online users
● Data growth
● Testability (and hence modularity)
● External integration points
● Response generation eagerness - sync, or async
Micro Services done right
● It’s more social than technical
● Always start with monolith and scale gradually
● Scaling few business use cases
○ Computational complexity
○ Number of requests and responsiveness
● Scaling a business module
○ Computational complexity
○ Software as a Service
● Scaling a team
○ Programming platform expertise
○ Business Domain expertise
○ Maintenance
● Embrace async flow and Distributed Message Queues
Use DDD iff Domain is Rich and Complex
KoaJS
● By authors which gave us ExpressJS
● ES6 Framework
● Promise continuation based on “co” library
● Modular Architecture
● Composable
● Compatible with NodeJS 4.x and later
● Various community plugins
http://koajs.com/
PM2 Process Manager
● Superior version of “cluster” module
● Load Balancing & Zero second Downtime Reload
● Compatible with almost all major web frameworks
● CPU Process monitors
● Log monitors
http://pm2.keymetrics.io/
Hybrid Apps with Cordova
Cordova Architecture
Cordova Apps
● Written in HTML, CSS and JS
● Single codebase for multiple target platforms
○ Internet Browsers - IE, firefox, Chrome, Safari etc.
○ Mobile devices - Android, iOS, Windows etc.
● Webview - Chrome browser engine
● Fast development cycles compared to Native apps
● HTML5 Canvas for Game Programming
● Modern WebViews are as responsive as Native platform
● Access various device features through cordova plugins
https://cordova.apache.org
Features/Characteristics Hybrid Native
Runs on Chrome browser runtime OS runtime
Additional Runtime Crosswalk for 4.x, Not required for 5.x and later Not required
Approximate Software artefact
download size for say 10 screens
4.5 MB for 4.x, 3 MB for Android 5.x and later 4 MB
Increase in download Size due to
additional runtime
23 MB (one time) for Android 4.x and iOS 7 ZERO
Development HTML, CSS and JS, More widely adopted tools Java for Android, Swift for iOS
Required Tech Skills Anyone who knows web programming specific skill according to platform and
native SDK
Supported Platform Android, iOS, Windows, Symbian etc. only one platform
Relative Development and Debugging
time and responding to frequently
changing business requirements
1x 2x to 3x
Performance
Responsive. can be tuned to minute level of browser runtime
Best in class. Can be tuned to minute
level to OS runtime
Security Issues:
Insecure local data storage
Weak SSL implementation
Unintended data leaks
Reverse Engineering
Code Injection
Can be dealt Can be dealt
Additional features supported Only major features are supported. here is the detailed list
https://cordova.apache.org/docs/en/latest/guide/support/
All of which device is capable of
ClojureScript
ClojureScript
● by Rich Hickey
● Compiles to JS
● LISP - Code is Data is Code
● Macros - Homoiconicity
● Immutable Data Structures - Referential transparency
● Higher Order Functions - Sheer joy of computation
● Google Closure compiler - Lots of goodies including dead code elimination
● Figwheel - Interactive development
● Nice interop with JS and NPM
● Higher learning curve but worth it
https://clojurescript.org/
Reagent
● Based on React
○ Functional
○ Component based architecture
○ Higher order components
● Hiccup (embed HTML)
● reagent-utils
● re-frame
https://reagent-project.github.io
core.async
● CSP implementation for Clojure(Script)
● First class Goroutines support inspired by Go lang
● Being Reactive
○ Responsive - Rapid and consistent response time with reliable upper bounds
○ Resilient - replication, containment, isolation and delegation.
○ Elastic - responsive under varying workload, ability to add
○ Message Driven - loose coupling, isolation and location transparency.
http://www.reactivemanifesto.org/
Thank You
Piyush Katariya
@AhamPiyush

More Related Content

What's hot (20)

PPTX
Test driven development v1.0
Ganesh Kondal
 
PDF
Stockholm JAM September 2018
Andrey Devyatkin
 
PDF
'How to build your first micro frontend in a matter of minutes' by Vladlen Fe...
OdessaJS Conf
 
PDF
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
PDF
Perl6 DBDI YAPC::EU 201008
Tim Bunce
 
PPTX
Building Massive AngularJS Apps
Gordon Bockus
 
PPTX
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
PDF
Clojure presentation
Karthik Raghunahtan
 
PDF
'Architecture of modern frontend apps' by YURIY DOBRYANSKYY at OdessaJS'2020
OdessaJS Conf
 
PDF
Workflow Yapceu2010
Jonas Brømsø
 
PDF
Sprint Boot & Kotlin - Meetup.pdf
Christian Zellot
 
PPT
Testing Storm components with Groovy and Spock
Eugene Dvorkin
 
PDF
Adopting language server for apache camel feedback from a java/Eclipse plugi...
Aurélien Pupier
 
PDF
Assembly thy Web
Martin Ockajak
 
PPTX
Kotlin - A Programming Language
Mobio Solutions
 
PDF
Simple Pure Java
Anton Keks
 
PPTX
Java 8 parallel stream
Yung Chieh Tsai
 
PDF
Yet Another Continuous Integration Story
Anton Serdyuk
 
PPTX
The modern view on implementation of classic design patterns in Java
Mikalai Alimenkou
 
PPTX
JAVA 8 Parallel Stream
Tengwen Wang
 
Test driven development v1.0
Ganesh Kondal
 
Stockholm JAM September 2018
Andrey Devyatkin
 
'How to build your first micro frontend in a matter of minutes' by Vladlen Fe...
OdessaJS Conf
 
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
Perl6 DBDI YAPC::EU 201008
Tim Bunce
 
Building Massive AngularJS Apps
Gordon Bockus
 
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
Clojure presentation
Karthik Raghunahtan
 
'Architecture of modern frontend apps' by YURIY DOBRYANSKYY at OdessaJS'2020
OdessaJS Conf
 
Workflow Yapceu2010
Jonas Brømsø
 
Sprint Boot & Kotlin - Meetup.pdf
Christian Zellot
 
Testing Storm components with Groovy and Spock
Eugene Dvorkin
 
Adopting language server for apache camel feedback from a java/Eclipse plugi...
Aurélien Pupier
 
Assembly thy Web
Martin Ockajak
 
Kotlin - A Programming Language
Mobio Solutions
 
Simple Pure Java
Anton Keks
 
Java 8 parallel stream
Yung Chieh Tsai
 
Yet Another Continuous Integration Story
Anton Serdyuk
 
The modern view on implementation of classic design patterns in Java
Mikalai Alimenkou
 
JAVA 8 Parallel Stream
Tengwen Wang
 

Viewers also liked (14)

PPTX
JavaScript (without DOM)
Piyush Katariya
 
PDF
Javascript Libraries & Frameworks | Connor Goddard
Connor Goddard
 
PDF
JavaScript Libraries: The Big Picture
Simon Willison
 
PPTX
Java vs javascript (XPages)
Andrew Barickman
 
PDF
JavaOne 2014: Java vs JavaScript
Chris Bailey
 
PDF
Javascript libraries
Dumindu Pahalawatta
 
PDF
Java vs. Java Script for enterprise web applications - Chris Bailey
JAXLondon_Conference
 
PDF
Choosing Javascript Libraries to Adopt for Development
Edward Apostol
 
PPTX
Hybrid Mobile Development
Shai Raiten
 
PDF
10 Building Blocks for Enterprise JavaScript
Geertjan Wielenga
 
PDF
Tools For jQuery Application Architecture (Extended Slides)
Addy Osmani
 
PDF
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
FITC
 
PDF
Microservice Architecture on AWS using AWS Lambda and Docker Containers
Danilo Poccia
 
PDF
Scalable JavaScript Application Architecture
Nicholas Zakas
 
JavaScript (without DOM)
Piyush Katariya
 
Javascript Libraries & Frameworks | Connor Goddard
Connor Goddard
 
JavaScript Libraries: The Big Picture
Simon Willison
 
Java vs javascript (XPages)
Andrew Barickman
 
JavaOne 2014: Java vs JavaScript
Chris Bailey
 
Javascript libraries
Dumindu Pahalawatta
 
Java vs. Java Script for enterprise web applications - Chris Bailey
JAXLondon_Conference
 
Choosing Javascript Libraries to Adopt for Development
Edward Apostol
 
Hybrid Mobile Development
Shai Raiten
 
10 Building Blocks for Enterprise JavaScript
Geertjan Wielenga
 
Tools For jQuery Application Architecture (Extended Slides)
Addy Osmani
 
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
FITC
 
Microservice Architecture on AWS using AWS Lambda and Docker Containers
Danilo Poccia
 
Scalable JavaScript Application Architecture
Nicholas Zakas
 
Ad

Similar to JavaScript for Enterprise Applications (20)

PDF
Node.js #digpen presentation
GOSS Interactive
 
PDF
Node.js Enterprise Middleware
Behrad Zari
 
KEY
The Architect Way
Jan Jongboom
 
PDF
Meetup. Technologies Intro for Non-Tech People
IT Arena
 
PPTX
L02 Architecture
Ólafur Andri Ragnarsson
 
PDF
The JavaScript Delusion
JUGBD
 
PDF
Node.JS briefly introduced
Alexandre Lachèze
 
PDF
The working architecture of NodeJS applications, Виктор Турский
Sigma Software
 
PDF
The working architecture of node js applications open tech week javascript ...
Viktor Turskyi
 
PDF
Node.js
Matt Simonis
 
PDF
Best practices for JavaScript RIAs
Carlos Ble
 
PDF
IBM InterConnect: Java vs JavaScript for Enterprise WebApps
Chris Bailey
 
PDF
High quality Front-End
David Simons
 
PPTX
L23 Summary and Conclusions
Ólafur Andri Ragnarsson
 
PDF
The Developers World
Ronald Northrip
 
ODP
Javascript Update May 2013
RameshNair6
 
PPTX
Shut Up And Eat Your Veg
Garth Gilmour
 
PPTX
JavaScript: The Machine Language of the Ambient Computing Era
Allen Wirfs-Brock
 
PPT
Node js
Chirag Parmar
 
PDF
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Ivan Loire
 
Node.js #digpen presentation
GOSS Interactive
 
Node.js Enterprise Middleware
Behrad Zari
 
The Architect Way
Jan Jongboom
 
Meetup. Technologies Intro for Non-Tech People
IT Arena
 
L02 Architecture
Ólafur Andri Ragnarsson
 
The JavaScript Delusion
JUGBD
 
Node.JS briefly introduced
Alexandre Lachèze
 
The working architecture of NodeJS applications, Виктор Турский
Sigma Software
 
The working architecture of node js applications open tech week javascript ...
Viktor Turskyi
 
Node.js
Matt Simonis
 
Best practices for JavaScript RIAs
Carlos Ble
 
IBM InterConnect: Java vs JavaScript for Enterprise WebApps
Chris Bailey
 
High quality Front-End
David Simons
 
L23 Summary and Conclusions
Ólafur Andri Ragnarsson
 
The Developers World
Ronald Northrip
 
Javascript Update May 2013
RameshNair6
 
Shut Up And Eat Your Veg
Garth Gilmour
 
JavaScript: The Machine Language of the Ambient Computing Era
Allen Wirfs-Brock
 
Node js
Chirag Parmar
 
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Ivan Loire
 
Ad

More from Piyush Katariya (6)

PDF
Concurrency, Parallelism And IO
Piyush Katariya
 
PDF
Handling the growth of data
Piyush Katariya
 
PDF
Expression problem
Piyush Katariya
 
PDF
My inspirations and learned lessons
Piyush Katariya
 
PPTX
Rise of the Single Page Application
Piyush Katariya
 
PPTX
Introduction to Web Application Clustering
Piyush Katariya
 
Concurrency, Parallelism And IO
Piyush Katariya
 
Handling the growth of data
Piyush Katariya
 
Expression problem
Piyush Katariya
 
My inspirations and learned lessons
Piyush Katariya
 
Rise of the Single Page Application
Piyush Katariya
 
Introduction to Web Application Clustering
Piyush Katariya
 

Recently uploaded (20)

PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
July Patch Tuesday
Ivanti
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
July Patch Tuesday
Ivanti
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 

JavaScript for Enterprise Applications

  • 3. We believe in meaningful iterations such as ...
  • 5. Why ( people rant / believe / think ) JavaScript sucks ?
  • 6. Most like it Static and Strong ● Dynamic : ○ Duck typing (No help from Compiler) ○ Late binding (Runtime is the King) ○ Polymorphism by capability ● Weak : ○ Not agnostic about types while code execution (Recipe for all disasters) ○ Allow weird operations ( [ ] + { } ) ○ Implicit conversions ( “2” * “3” = 6 ) ● Static typing does not mean that TDD/BDD can be ignored ● Productivity due to ○ Duck typing ○ Map/JSON over concrete object
  • 7. Other Accusations My reply against Accusation for To reactions by Newbies Yep it sucks. Use “yield” instead Callbacks WTF ??? Better syntax and error handling but use “yield” instead Promises Really ?? WTF ??? Corporate vs Open specification trade off Are your requirements clear ? Evaluate case by case basis. Fragmented community at least hundred options of libs and frameworks for given task What to choose ? Why to choose ? Why isn’t there a standard ? Understand Concurrency vs Parallelism. Little slower at computation but much better at memory usage and IO multiplexing than JVM/CLR. No synchronization problems. period. Single threaded and Slow Execution is slow because its dynamic language ! What ? It does not have multithreading support??? Atom, Visual Code, ESLint, TypeScript ? IDE, Compiler Basic and Refactoring support ? Procedural, functional and event driven Multiple Paradigm confusion OO, Prototypal, functional, event ?
  • 8. Paradigms and Disciplines ● Structured [ Edgar Dijkstra : Go To Statement Considered Harmful ] ○ Avoid “goto” statements ○ Embrace block structures, for/while loops and small functions/subroutines ● Object Oriented [ Simula and Simula-67 language] ○ Avoid pointer to functions ○ Embrace code reuse - Inheritance and (Parametric and Subtype) Polymorphism ● Functional [ John McCarthy : LISP ] ○ Avoid variables, use only constants (Referential Transparency) ○ Avoid mutation or IO side effects (or reduce it by wrapping it inside a Monad) ○ Embrace Higher Order functions, Recursion, Persistent data structures, CT ● Event Driven [CSP, Actor Model] ○ Avoid function/subroutine call by direct reference ○ Embrace communication between isolated components by generating an event and registering callback function/subroutine
  • 10. What they ignore (or less aware of) ➔ Application reload within milliseconds during development and deployment ➔ PM2 process manager for painless deployment and monitoring ➔ V8 engine performance ➔ Serving Tens of thousands of network connections with little memory overhead ➔ ES6 “yield” is here. ES7 “async” and “await” is not necessary ➔ Using Babel (transpiler) to emit ECMAScript 5 code ➔ RamdaJS and date-fp - functional replacement for collection and date API ➔ Programmable Module level polymorphism using CommonJS ➔ Isomorphism - Mobile devices, Browser, Server and NoSql DB query ➔ NodeJS Long Time Support - https://github.com/nodejs/LTS
  • 11. ES6 Basics and Generators
  • 12. ECMAScript 6 ● No semicolons ● Fat arrows (with bind feature) ● Template strings ● let - control scoping ● const - control assignments ● Destructuring ● Generator ○ Lazy collections ○ Avoid callbacks ○ Avoid promise (use but not creation) ● for-of loop All features :- http://es6-features.org/
  • 13. Must Have ESLint and FP plugin ● eslint - Takes care of JS language quirks ● eslint_plugin_fp - JS as pure FP language fp/no-arguments fp/no-mutating-methods fp/no-class fp/no-mutation fp/no-delete fp/no-nil fp/no-events fp/no-proxy fp/no-get-set fp/no-rest-parameters fp/no-let fp/no-this fp/no-loops fp/no-throw fp/no-mutating-assign fp/no-unused-expression no-var fp/no-valueof-field
  • 15. C S P for Dummies ➔ Don't communicate by sharing state, share state by communicating ➔ Communicating ◆ Conversation over channel/queues/distributed queues ◆ Remote procedure calls ➔ Sequential ◆ Execution flow ➔ Processess ◆ Coroutines ◆ Green threads (scheduled by VM) ◆ Real threads (scheduled by OS) ◆ OS Process ◆ Machines ◆ Cluster of Machines ➔ Original Paper - http://usingcsp.com/cspbook.pdf
  • 16. CSP vs Actor Model CSP Actor Model Process Identity Anonymous Concrete Message Passing Synchronous Asynchronous Communication Channels/Queues Direct Composition NA Applicable Fault Tolerance Easy to built with Distributed Queue Hierarchy of Local and Distributed Supervisors ➔ Hybrid approach is also viable and more practical
  • 18. Data - Structure and Types ● Data is all we have ● Data is what we need to transform in order to create a user experience ○ Photoshop without the images is nothing ○ Word is nothing without the characters ● Instructions are data too ● Immutability matters ○ Value - Always Immutable ○ State - Snapshot. Value of something at certain point of time ○ Identity - Stable logical entity associated with a series of different values over time ○ Time - Relative term, not physically measurable
  • 19. Computation - Function and HOF ● Higher Order Function (does either or both) ○ Accepts a function ○ Returns a function ● Higher order abstraction for ○ Computation ○ Combinators ○ DSL - Composition of computation and combinators
  • 20. Thinking functionally ● Use function as first class citizen to build abstraction ● Avoid mutation of variable(memory pointer handle) and data (state) ● Chant this mantra every morning, “null is a billion dollar mistake” ● Favour recursion over iteration ● Procure laziness with Streams ● Use expressions over statements ● Composition over inheritance ● Many identical functions for few data structures than few different functions for many data structures
  • 21. RamdaJS HOF Abstraction ● Auto Currying ● Abstraction Categories ○ Object ○ Function ○ List ○ Math ○ Logic ○ Relation ○ Type ● Transducers http://ramdajs.com/docs/
  • 23. Software Architecture in a nutshell “ In most successful software projects, the expert developers working on that project have a shared understanding of the design. This shared understanding is called ‘Architecture.’ This understanding includes how the system is divided into components and how the components interact through interfaces. These components are usually composed of smaller components, but the architecture only includes the components and interfaces that are understood by all the developers ” - Martin Fowler
  • 24. Abstraction and Indirection “ The essence of abstractions is preserving information that is relevant in a given context, and forgetting information that is irrelevant in that context ” – John V. Guttag “ In computer programming, indirection is the ability to reference something using a name, reference, or container instead of the value itself ” “ All problems in computer science can be solved by another level of indirection ….” - David Wheeler
  • 25. “ ….. except the problem of too many layers of indirection ” “ Making something easy to change makes the overall system a little more complex, and making everything easy to change makes the entire system very complex. Complexity is what makes software hard to change “
  • 27. Architecture decisions starts with “ Optimism is an occupational hazard of programming; feedback is the treatment. ” - Kent Beck ● Initial market research for given Business Domain ● Security ● Transaction capability and boundaries ● Online active users growth - total vs active vs online users ● Data growth ● Testability (and hence modularity) ● External integration points ● Response generation eagerness - sync, or async
  • 28. Micro Services done right ● It’s more social than technical ● Always start with monolith and scale gradually ● Scaling few business use cases ○ Computational complexity ○ Number of requests and responsiveness ● Scaling a business module ○ Computational complexity ○ Software as a Service ● Scaling a team ○ Programming platform expertise ○ Business Domain expertise ○ Maintenance ● Embrace async flow and Distributed Message Queues
  • 29. Use DDD iff Domain is Rich and Complex
  • 30. KoaJS ● By authors which gave us ExpressJS ● ES6 Framework ● Promise continuation based on “co” library ● Modular Architecture ● Composable ● Compatible with NodeJS 4.x and later ● Various community plugins http://koajs.com/
  • 31. PM2 Process Manager ● Superior version of “cluster” module ● Load Balancing & Zero second Downtime Reload ● Compatible with almost all major web frameworks ● CPU Process monitors ● Log monitors http://pm2.keymetrics.io/
  • 32. Hybrid Apps with Cordova
  • 34. Cordova Apps ● Written in HTML, CSS and JS ● Single codebase for multiple target platforms ○ Internet Browsers - IE, firefox, Chrome, Safari etc. ○ Mobile devices - Android, iOS, Windows etc. ● Webview - Chrome browser engine ● Fast development cycles compared to Native apps ● HTML5 Canvas for Game Programming ● Modern WebViews are as responsive as Native platform ● Access various device features through cordova plugins https://cordova.apache.org
  • 35. Features/Characteristics Hybrid Native Runs on Chrome browser runtime OS runtime Additional Runtime Crosswalk for 4.x, Not required for 5.x and later Not required Approximate Software artefact download size for say 10 screens 4.5 MB for 4.x, 3 MB for Android 5.x and later 4 MB Increase in download Size due to additional runtime 23 MB (one time) for Android 4.x and iOS 7 ZERO Development HTML, CSS and JS, More widely adopted tools Java for Android, Swift for iOS Required Tech Skills Anyone who knows web programming specific skill according to platform and native SDK Supported Platform Android, iOS, Windows, Symbian etc. only one platform Relative Development and Debugging time and responding to frequently changing business requirements 1x 2x to 3x Performance Responsive. can be tuned to minute level of browser runtime Best in class. Can be tuned to minute level to OS runtime Security Issues: Insecure local data storage Weak SSL implementation Unintended data leaks Reverse Engineering Code Injection Can be dealt Can be dealt Additional features supported Only major features are supported. here is the detailed list https://cordova.apache.org/docs/en/latest/guide/support/ All of which device is capable of
  • 37. ClojureScript ● by Rich Hickey ● Compiles to JS ● LISP - Code is Data is Code ● Macros - Homoiconicity ● Immutable Data Structures - Referential transparency ● Higher Order Functions - Sheer joy of computation ● Google Closure compiler - Lots of goodies including dead code elimination ● Figwheel - Interactive development ● Nice interop with JS and NPM ● Higher learning curve but worth it https://clojurescript.org/
  • 38. Reagent ● Based on React ○ Functional ○ Component based architecture ○ Higher order components ● Hiccup (embed HTML) ● reagent-utils ● re-frame https://reagent-project.github.io
  • 39. core.async ● CSP implementation for Clojure(Script) ● First class Goroutines support inspired by Go lang ● Being Reactive ○ Responsive - Rapid and consistent response time with reliable upper bounds ○ Resilient - replication, containment, isolation and delegation. ○ Elastic - responsive under varying workload, ability to add ○ Message Driven - loose coupling, isolation and location transparency. http://www.reactivemanifesto.org/