Modular Programming with JavaScript

Modularize your JavaScript code for better readability, greater maintainability, and enhanced testability

Modular Programming with JavaScript

This ebook is included in a Mapt subscription
Sasan Seydnejad

2 customer reviews
Modularize your JavaScript code for better readability, greater maintainability, and enhanced testability
$0.00
$18.00
$44.99
$29.99p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781785880650
Paperback274 pages

Book Description

Programming in the modular manner is always encouraged for bigger systems—it is easier to achieve scalability with modular programming. Even JavaScript developers are now interested in building programs in a modular pattern. Modules help people who aren’t yet familiar with code to find what they are looking for and also makes it easier for programmers to keep things that are related close together.

Designing and implementing applications in a modular manner is highly encouraged and desirable in both simple and enterprise level applications.

This book covers some real-life examples of modules and how we can translate that into our world of programming and application design. After getting an overview of JavaScript object-oriented programming (OOP) concepts and their practical usage, you should be able to write your own object definitions using the module pattern. You will then learn to design and augment modules and will explore the concepts of cloning, inheritance, sub-modules, and code extensibility. You will also learn about SandBoxing, application design, and architecture based on modular design concepts. Become familiar with AMD and CommonJS utilities.

By the end of the book, you will be able to build spectacular modular applications in JavaScript.

Table of Contents

Chapter 1: What Are Modules and Their Advantages?
Prelude to modular programming
The simple rule for creating modules
A real-life example of modules
A look at a non-modular example
Re-factoring to a more modularized approach
Designing in a modular way
Summary
Chapter 2: Review of Important JavaScript OOP Concepts
JavaScript objects
Summary
Chapter 3: Module Design Pattern
Module pattern
Creating loose coupling among modules
Summary
Chapter 4: Designing Simple Modules
The big picture
Designing our SPA main pieces
Summary
Chapter 5: Module Augmentation
Principles of module augmentation
Implementing module augmentation
Simple augmentation of ImagesInc_GlobalData
The order of things in module augmentation
Loose augmentation of modules
Tight augmentation of modules
Generating our application's content area
Summary
Chapter 6: Cloning, Inheritance, and Submodules
Cloning modules
Creating ImagesInc_Utilites module
Inheritance in modules
Submodules
Summary
Chapter 7: Base, Sandbox, and Core Modules
Application architecture overview
Base module
Sandbox module
Core module
Components
Application architectural considerations
Summary
Chapter 8: Application Implementation – Putting It All Together
The user's view of our application
Application functionality
Application implementation
Application components
GlobalData module
Summary
Chapter 9: Modular Application Design and Testing
Advantages of writing automated tests
Different types of automated tests
A simple start to writing our unit tests
Summary
Chapter 10: Enterprise Grade Modular Design, AMD, CommonJS, and ES6 Modules
Revisiting index.html file
Introducing Asynchronous Module Definition
CommonJS
ECMAScript 6 modules
Summary

What You Will Learn

  • Understand the important concepts of OOP in JavaScript, such as scope, objects, inheritance, event delegation, and more
  • Find out how the module design pattern is used in OOP in JavaScript
  • Design and augment modules using both tight augmentation and loose augmentation
  • Extend the capabilities of modules by creating sub-modules using techniques such as cloning and inheritance
  • Move from isolated module pieces to a cohesive, well integrated application modules that can interact and work together without being tightly coupled
  • See how SandBoxing is used to create a medium for all the modules to talk to each other as well as to the core
  • Use the concepts of modular application design to handle dependencies and load modules asynchronously
  • Become familiar with AMD and CommonJS utilities and discover what the future of JavaScript holds for modular programming and architecture

Authors

Table of Contents

Chapter 1: What Are Modules and Their Advantages?
Prelude to modular programming
The simple rule for creating modules
A real-life example of modules
A look at a non-modular example
Re-factoring to a more modularized approach
Designing in a modular way
Summary
Chapter 2: Review of Important JavaScript OOP Concepts
JavaScript objects
Summary
Chapter 3: Module Design Pattern
Module pattern
Creating loose coupling among modules
Summary
Chapter 4: Designing Simple Modules
The big picture
Designing our SPA main pieces
Summary
Chapter 5: Module Augmentation
Principles of module augmentation
Implementing module augmentation
Simple augmentation of ImagesInc_GlobalData
The order of things in module augmentation
Loose augmentation of modules
Tight augmentation of modules
Generating our application's content area
Summary
Chapter 6: Cloning, Inheritance, and Submodules
Cloning modules
Creating ImagesInc_Utilites module
Inheritance in modules
Submodules
Summary
Chapter 7: Base, Sandbox, and Core Modules
Application architecture overview
Base module
Sandbox module
Core module
Components
Application architectural considerations
Summary
Chapter 8: Application Implementation – Putting It All Together
The user's view of our application
Application functionality
Application implementation
Application components
GlobalData module
Summary
Chapter 9: Modular Application Design and Testing
Advantages of writing automated tests
Different types of automated tests
A simple start to writing our unit tests
Summary
Chapter 10: Enterprise Grade Modular Design, AMD, CommonJS, and ES6 Modules
Revisiting index.html file
Introducing Asynchronous Module Definition
CommonJS
ECMAScript 6 modules
Summary

Book Details

ISBN 139781785880650
Paperback274 pages
Read More
From 2 reviews

Read More Reviews