본문 바로가기
James Cooper - Python Programming with D

Index

by 자동매매 2023. 3. 23.

You can find complete working code for all these programs on GitHub at
https://github.com/jwcnmr/jameswcooper/tree/main/Pythonpatterns.

This book is organized into five parts.


Part I, “Introduction”


Design patterns essentially describe how objects can interact effectively.
This book starts by introducing objects in Chapter 1, “Introduction to
Objects,” and providing graphical examples that clearly illustrate how the
patterns work.
Chapter 2, “Visual Programming in Python,” and Chapter 3, “Visual
Programming of Tables of Data,” introduce the Python tkinter library,
which gives you a way to create windows, buttons, lists, tables, and more
with minimal complexity.
Chapter 4, “What Are Design Patterns?”, begins the discussion of design
patterns by exploring exactly what they are.

 

Part II, “Creational Patterns”


Part II starts by outlining the first group of patterns that the “Gang of Four”
named Creational Patterns.
Chapter 5, “The Factory Pattern,” describes the basic Factory pattern, which
serves as the simple basis of the three factory patterns that follow. In this
chapter, you create a Factory class that decides which of several related
classes to use, based on the data itself.
Chapter 6, “The Factory Method Pattern,” explores the Factory method. In
this pattern, no single class makes the decision as to which subclass to
instantiate. Instead, the superclass defers the decision to each subclass.
Chapter 7, “The Abstract Factory Pattern,” discusses the Abstract Factory
pattern. You can use this pattern when you want to return one of several
related classes of objects, each of which can return several different objects
on request. In other words, the Abstract Factory is a factory object that
returns one of several groups of classes.
Chapter 8, “The Singleton Pattern,” looks at the Singleton pattern, which
describes a class in which there can be no more than one instance. It
provides a single global point of access to that instance. You don’t use this
pattern all that often, but it is helpful to know how to write it.
In Chapter 9, “The Builder Pattern,” you see that the Builder pattern
separates the construction of a complex object from its visual
representation, so that several different representations can be created,
depending on the needs of the program.
Chapter 10, “The Prototype Pattern,” shows how to use the Prototype
pattern when creating an instance of a class is time consuming or complex.
Instead of creating more instances, you make copies of the original instance
and modify them as appropriate.
Chapter 11 , “Summary of Creational Patterns,” just summarizes the patterns
in Part II.

 

Part III, “Structural Patterns”


Part III begins with a short discussion of Structural Patterns.
Chapter 12, “The Adapter Pattern,” examines the Adapter pattern, which is
used to convert the programming interface of one class into that of another.
Adapters are useful whenever you want unrelated classes to work together
in a single program.
Chapter 13, “The Bridge Pattern,” takes up the similar Bridge pattern,
which is designed to separate a class’s interface from its implementation.
This enables you to vary or replace the implementation without changing
the client code.
Chapter 14, “The Composite Pattern,” delves into systems in which a
component may be an individual object or may represent a collection of
objects. The Composite pattern is designed to accommodate both cases,
often in a treelike structure.
In Chapter 15, “The Decorator Pattern,” we look at the Decorator pattern,
which provides a way to modify the behavior of individual objects without
having to create a new derived class. Although this can apply to visual
objects such as buttons, the most common use in Python is to create a kind
of macro that modifies the behavior of a single class instance.
In Chapter 16, “The Façade Pattern,” we learn to use the Façade pattern to
write a simplifying interface to code that otherwise might be unduly
complex. This chapter deals with such an interface to a couple of different
databases.
Chapter 17, “The Flyweight Pattern,” describes the Flyweight pattern,
which enables you to reduce the number of objects by moving some of the
data outside the class. You can consider this approach when you have
multiple instances of the same class.
Chapter 18, “The Proxy Pattern,” looks at the Proxy pattern, which is used
when you need to represent an object that is complex or time consuming to
create, by a simpler one. If creating an object is expensive in time or
computer resources, Proxy enables you to postpone creation until you need
the actual object.
Chapter 19, “Summary of Structural Patterns,” summarizes these Structural
patterns.

 

Part IV, “Behavioral Patterns”


Part IV outlines the Behavioral Patterns.
Chapter 20, “Chain of Responsibility Pattern,” looks at how the Chain of
Responsibility pattern allows a decoupling between objects by passing a
request from one object to the next in a chain until the request is
recognized.
Chapter 21, “The Command Pattern,” shows how the Command pattern
uses simple objects to represent the execution of software commands.
Additionally, this pattern enables you to support logging and undoable
operations.
Chapter 22, “The Interpreter Pattern,” looks at the Interpreter pattern, which
provides a definition of how to create a little execution language and
include it in a program.
In Chapter 23, “The Iterator Pattern,” we explore the well-known Iterator
pattern, which describes the formal ways you can move through a collection
of data items.
Chapter 24, “The Mediator Pattern,” takes up the important Mediator
pattern. This pattern defines how communication between objects can be
simplified by using a separate object to keep all objects from having to
know about each other.
Chapter 25, “The Memento Pattern,” saves the internal state of an object, so
you can restore it later.
In Chapter 26, “The Observer Pattern,” we look at the Observer pattern,
which enables you to define the way a number of objects can be notified of
a change in a program state.
Chapter 27, “The State Pattern,” describes the State pattern, which allows
an object to modify its behavior when its internal state changes.
Chapter 28, “The Strategy Pattern,” describes the Strategy pattern, which,
like the State pattern, switches easily between algorithms without any
monolithic conditional statements. The difference between the State and
Strategy patterns is that the user generally chooses which of several
strategies to apply.
In Chapter 29, “The Template Pattern,” we look at the Template pattern.
This pattern formalizes the idea of defining an algorithm in a class but
leaves some of the details to be implemented in subclasses. In other words,
if your base class is an abstract class, as often happens in these design
patterns, you are using a simple form of the Template pattern.
Chapter 30, “The Visitor Pattern,” explores The Visitor pattern, which turns
the tables on the object-oriented model and creates an external class to act
on data in other classes. This is useful if there are a fair number of instances
of a small number of classes and you want to perform some operation that
involves all or most of them.

 

Part V, “A Brief Introduction to Python”


In this last section of the book, we provide a succinct summary of the
Python language. If you are only passingly familiar with Python, this will
get you up to speed. It is sufficiently thorough to instruct beginner as well.
In Chapter 31, “Variables and Syntax in Python,” we review the basic
Python variables and syntax, and in Chapter 32, “Making Decisions in
Python,” we illustrate the ways your programs can make decisions.
In Chapter 33, “Development Environments,” we provide a short summary
of the most common development environments, and in Chapter 34,
“Python Collections and Files,” we discuss arrays and files.
Finally in Chapter 35, “Functions,” we take up how to use functions on
Python.
Enjoy writing design patterns and learning the ins and outs of the powerful
Python language!

'James Cooper - Python Programming with D' 카테고리의 다른 글

The Factory Pattern  (0) 2023.03.23
What Are Design Patterns?  (0) 2023.03.23
Visual Programming of Tables of Data  (0) 2023.03.23
Visual Programming in Python  (0) 2023.03.23
Introduction  (0) 2023.03.23

댓글