Skip to Content
Programming JavaScript Applications
book

Programming JavaScript Applications

by Eric Elliott
June 2014
Intermediate to advanced
254 pages
6h 2m
English
O'Reilly Media, Inc.
Content preview from Programming JavaScript Applications

Chapter 5. Separation of Concerns

Separation of concerns is the idea that each module or layer in an application should only be responsible for one thing and should not contain code that deals with other things. Separating concerns reduces code complexity by breaking a large application down into many smaller units of encapsulated functionality.

It’s easy to confuse separation of concerns with employing modules for the construction of your application, but separation of concerns also implies the layering of functionality in your application. For example, n-tier architecture and MVC architectures are the result of separating concerns across the entire application, rather than at the individual module level. The goal of MVC and related patterns is to separate data management from presentation.

Separation of concerns can be expressed as functions, modules, controls, widgets, layers, tiers, services, and so on. The various units of concern vary from one app to the next, and each different app may use a different combination. Functions and modules have already been discussed.

A control is a reusable GUI input that enables user interaction with your application. For example, combo boxes, calendar inputs, sliders, buttons, switches, and knobs are all controls.

A widget is a small application which is intended to be embedded in other applications. For example, WordPress allows developers to offer embeddable units of functionality to blog owners through its plug-in ecosystem. There are many ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JavaScript : Object-Oriented Programming

JavaScript : Object-Oriented Programming

Kumar Chetan Sharma et al
Testing JavaScript Applications

Testing JavaScript Applications

Lucas Fernandes da Costa

Publisher Resources

ISBN: 9781491950289Errata PageSupplemental Content