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

FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns

FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns

Slide from Frontend Re-United Kathmandu.
Date: May 18, 2019

Frontend spectrum is changing rapidly. As new changes arrive, we have to be open to adopting new and better patterns and libraries. Learn about how the JavaScript scene has been evolving over the years.

Leapfrog Technology

May 18, 2019
Tweet

More Decks by Leapfrog Technology

Other Decks in Technology

Transcript

  1. Early Web and JavaScript • AJAX based applications • All

    JavaScript bundled into one file • jQuery • IIFEs everywhere • Imperative code
  2. JS Modules in Brief • ES6 syntax + New Features

    • Creating smaller functions is easy • Default exports / Named exports • Import creates immutable bindings
  3. JS Modules to Components • One component should focus on

    one section of the UI. • Shouldn’t access another’s html directly. • Encapsulates its Output(html), Style (css) and Functionality (javascript). • Each component has some way to interact with others.
  4. JS Modules to Components • Separation of concerns • Major

    framework (React, Angular, Vue or <insert your framework here>) use this concepts
  5. Service Layers • How to make our components communicate with

    the backend? • Building boundaries with modules • Each task needs to be encapsulated • The component should not know more than what it requires • Centralizes external access to data and functions
  6. State Management • Global application state or Local component state?

    • Libraries for state management ◦ Redux ◦ MobX ◦ Vuex ◦ …
  7. Redux - Publish Subscribe Pattern User clicks something An action

    triggers Ok the state has changed Repaint where state changes need to be shown
  8. Middleware Pattern • Middlewares are written to be composable, meaning

    that multiple middleware functions can be run one after the other • Example: A logging middleware • Popular Example: redux-thunk (dispatch side-effects)
  9. Structuring The Modules • Better separation of concern • Feature

    based • Components bundled together • Easy to understand (but you need to know a lot more)
  10. Webpack Configuration • Build configuration as per your environment (production

    / development) • Use webpack plugins to extend your configuration
  11. Conclusion • The JavaScript ecosystem is ever changing • Adopt

    new changes along the way (not necessarily follow the hype) • JavaScript is moving to a functional / modular approach with better frameworks, libraries and build tools • The ecosystem is getting better • Cope along, follow the community