Home » » Download PDF Learning Python Design Patterns A practical and fast-paced guide exploring Python design patterns by Gennadiy Zlobin

Download PDF Learning Python Design Patterns A practical and fast-paced guide exploring Python design patterns by Gennadiy Zlobin


Sinopsis

Many applications start from something small, such as several hundred lines of code prototype of a toy application written in one evening. When you add new features and the application code clutters, it becomes much harder to understand how it works and to modify it, especially for a newcomer. The Model-View-Controller (MVC) pattern serves as the basis for software architecture that will be easily maintained and modified.

The main idea of MVC is about separating an application into three parts: model, view, and controller. There is an easy way to understand MVC—the model is the data and its business logic, the view is the window on the screen, and the controller is the glue between the two.

While the view and controller depend on the model, the model is independent of the presentation or the controller. This is a key feature of the division. It allows you to work with the model, and hence, the business logic of the application, regardless of the visual presentation.

The following diagram shows the flow of interaction between the user, controller, model, and view. Here, a user makes a request to the application and the controller does the initial processing. After that it manipulates the model, creating, updating, or deleting some data there. The model returns some result to the controller, that passes the result to view, which renders data to the user.

Content

  1. Model-View-Controller
  2. Creating Only One Object with the Singleton Pattern
  3. Building Factories to Create Objects
  4. The Facade Design Pattern
  5. Facilitating Object Communication with Proxy and Observer Patterns
  6. Encapsulating Calls with the Command Pattern
  7. Redefining Algorithms with the Template Method



0 komentar:

Posting Komentar