beta

6 Separation of Concerns in Practice

This chapter covers:

  • Developing an application with separate high-level concerns
  • Using specific types of encapsulation to loosen coupling of different concerns
  • Creating a well-separated foundation to enable future extension

In chapter 2, I showed you some of the best practices around separation of concerns in Python. Separating concerns means creating boundaries between code that deals with distinct activities to improve understanding. You learned how functions, classes, modules, and packages are useful in decomposing code into pieces that are easier to reason about. Although chapter 2 covered several of the tools available for separation of concerns, it’s pertinent to get some experience applying them in practice.

As is true for many, I learn best by doing. As you work through a real project, you often realize connections you didn’t see before, or raise new questions to explore. In this chapter, you’ll work through a real application that exhibits a good use case for separating concerns; you’ll improve upon it on the chapters to come, and end up with something you can extend for your own personal use.

6.1  A command-line bookmarking application

In this chapter you’ll develop an application for saving and organizing bookmarks (more specifics on that in a minute).

6.2  A tour of Bark

6.2.1  The benefits of separation: reprise

6.3  An initial code structure, by concern

6.3.1  The persistence layer

6.3.2  The business logic layer

6.3.3  The presentation layer

6.4  Summary

×

Ups!

Unfortunatly, we weren't able to load your books.
Retry

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage