In the talk we are discussing the best practices for creating modular Web applications. The talk focuses on practical advices and proven in the time methodologies for creating supportable and maintainable applications.
3. CHALLENGES
handling the Events
Subscribing and unsubscribing to events
Manipulating the dom
Manually? Virtual DOM? Re-DOM?
UNIT TESTS
Mock everything? Staying as close to the reality as possible?
maintaining the state
State might be spread among different services or components
4. CHALLENGES
OPTIMIZE APPLICATION
How to achieve maximum performance? Rendering on the server
too?
Integration and end2end tests
How do we keep them in sync with the code?
CONTINUOUS DEPLOYMENT AND DELIVERY
How easy is to make releases? How do we keep the documentation
in sync?
MAKING CHANGES TO THE SYSTEM
How to prevent the “Software rot”?
5. There is no silver bullet
Some of these challenges are technical, others aren’t
(Technical challenges are easier to solve)
8. 2011
2013
2010
react
Revolutionized the way Web
applications were built
ember
Model–view–viewmodel (MVVM) pattern
angular 1
Complete and rich, but complex and
hard for maintenance and support
FRAMEWORKS
and
libraries
12. MODULE
A “module” is a piece of
functionality, which could be
plugged to the application,
replaced if needed and
possibly reused
a piece of functionality
A module consists from
one or more components
One component should
stay in one module
13. LET’S TAKE A LOOK AT THE REAL WORLD
COMPONENTS AND MODULES
25. features as modules
Separate the features of the application in modules
One module may consist from multiple components
The feature should be tested individually
Then included to the application
26. COMPONENTS
Prefer to create components, which only render data
Create a few components to maintain the state
They will provide data to the rendering components
When testing, mock the external dependencies
27. Avoid framework dependencies when possible
Try to make your classes framework agnostic
Then “glue” them to you framework of choice
28. maintaining the state
Maintaining the state properly is the key to keep the
whole application maintainable
Use Flux pattern and some implementation like
Redux, MobX, or write your own
36. ES2015 Commonjs
module
systems
amd
Made popular
by Node, in
2013 they said
its dead
Standard, not
implemented in
the browsers
yet, but used
widely with
transpilers
Originally split
from
CommonJS, the
difference is the
async loading
37. ES2015
features
Re-exporting
Export an imported module
cyclic dependencies
better handled than in CommonJS
single default export
export function circle(x, y) {}
multiple named exports
export const sqrt = Math.sqrt;
39. Could be part of an Indoor Positioning System
Let’s create an application for
monitoring iBeacons in range
40. PARTS OF AN indoor positioning system
Venue maps
Indoor Radio Mapping tool
Detecting and monitoring Wi-Fi and Beacons
Positioning API
Location services/ End user applications
43. Architecture
Main parts of the system
Mobile application
Mobile application created with ReactNative
Web Application
Web application, created with React
Storage
Data storage
Server
NodeJS server to serve the Web application
45. The Communication with the server
Isolate it in a module
It could be implemented using WebSockets, WeDeploy, etc.
Location
Services
Indoor
Location
Services
Indoor
46. Detecting the beacons on iOS and android
Isolate the logic in modules with same API
and expose it to React Native
1 2
3 4
5 6
1 2
3 4
5 6
47. rendering the beacons on the screen
Isolate the logic in a module
1 2
3 4
5 6
1 2 3 4 5 6