Introduction
Explore the concept of JavaScript modules to achieve cohesive and well-structured code. Understand how to create modules, define what to export, and import dependencies, enabling you to organize complex applications effectively and reduce coding errors.
We'll cover the following...
We'll cover the following...
Cohesion
Well-designed software is cohesive.
“Cohesion is when a piece of code is narrow, focused, and does one thing well.”
A good designer strives to achieve cohesion at all levels:
- Functions
- Classes
- And, especially, files
Characteristics of a well-designed code file
A well-designed file should contain only things closely related to each other. Related items should be together in one file, and unrelated items should be apart from each other in ...