Badenhorst | Practical Python Design Patterns | E-Book | www.sack.de
E-Book

E-Book, Englisch, 352 Seiten

Badenhorst Practical Python Design Patterns

Pythonic Solutions to Common Problems
1. ed
ISBN: 978-1-4842-2680-3
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark

Pythonic Solutions to Common Problems

E-Book, Englisch, 352 Seiten

ISBN: 978-1-4842-2680-3
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark



Become a better, more productive programmer through a series of projects that will help you deeply understand and master each of the design patterns covered. In this book you will learn to write elegant 'Pythonic' code to solve common programming problems. You will also experience design thinking, by identifying design patterns that would be helpful given a specific problem or situation.
Python is eating the world. In recent years it has become so much more than a mere object-oriented, scripting language. Design patterns help you think of and solve problems in chunks. They help you to stand on the shoulders of the giants who have come before, instead of having to reinvent the wheel.

What You Will LearnCraft cleaner code
Increase your effectiveness as a programmer
Write more 'Pythonic' code
Solve bigger problems
Discover optimal solutions to common problems, done in a way that is uniquely 'Pythonic.'


Who This Book Is For Programmers who are comfortable with Python. It is also guide for people who have mastered other programming languages and who want to make the transition to Python.


Wessel Badenhorst is deeply passionate about the process of attaining mastery, especially in the field of programming. The combination of a BSc in computer science and extensive experience in the real world gives him a balanced and practical perspective on programming, and the road every programmer must walk.

Badenhorst Practical Python Design Patterns jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


1;Table of Contents;5
2;About the Author;12
3;About the Technical Reviewer;13
4;Acknowledgments;14
5;Chapter 1: Before We Begin;15
5.1; The Masters;15
5.2; Becoming a Better Programmer;17
5.2.1; Deliberate Practice;18
5.2.2; Single Focus;19
5.2.3; Rapid Feedback;19
5.2.4; Stretch Yourself;20
5.2.5; Stand on the Shoulders of Giants;21
5.2.6; How Do You Do This?;21
5.2.7; The Ability to Course Correct;22
5.3; Systems Thinking;23
5.4; Mental Models;23
5.5; The Right Tools for the Job;24
5.6; Design Patterns as a Concept;25
5.6.1; What Makes a Design Pattern?;25
5.6.2; Classification;26
5.6.2.1; Creational;26
5.6.2.2; Structural;26
5.6.2.3; Behavioral;27
5.7; The Tools We Will Be Using;27
5.8; How to Read This Book;27
5.9; Setting Up Your Python Environment;28
5.9.1; On Linux;28
5.9.2; On Mac;29
5.9.3; On Windows;30
5.9.4; VirtualEnv;31
5.10; Editors;32
5.10.1; Atom;33
5.10.2; LightTable;33
5.10.3; PyCharm;33
5.10.4; Vim;33
5.10.5; Emacs;34
5.10.6; Sublime Text;34
5.11; Summary;35
6;Chapter 2: The Singleton Pattern;36
6.1; The Problem;36
6.2; Enter the Objects;42
6.3; Cleaning It Up;45
6.4; Exercises;48
7;Chapter 3: The Prototype Pattern;49
7.1; The Problem;49
7.2; Beyond the First Steps;49
7.3; Base for an Actual Game;50
7.4; Implementing the Prototype Pattern;63
7.5; Shallow Copy vs. Deep Copy;64
7.6; Shallow Copy;65
7.7; Dealing with Nested Structures;66
7.8; Deep Copy;67
7.9; Using What We Have Learned in Our Project;68
7.10; Exercises;71
8;Chapter 4: Factory Pattern;73
8.1; Getting Started;73
8.2; The Game Loop;75
8.3; The Factory Method;80
8.4; The Abstract Factory;82
8.5; Summary;84
8.6; Exercises;85
9;Chapter 5: Builder Pattern;86
9.1; Anti-Patterns;95
9.1.1; A Note on Abstraction;100
9.2; Exercises;101
10;Chapter 6: Adapter Pattern;102
10.1; Don’t Repeat Yourself (DRY);104
10.2; Separation of Concern;104
10.3; Sample Problem;107
10.3.1; Class Adapter;108
10.3.2; Object Adapter Pattern;109
10.3.3; Duck Typing;110
10.4; Implementing the Adapter Pattern in the Real World;111
10.5; Parting Shots;113
10.6; Exercises;114
11;Chapter 7: Decorator Pattern;115
11.1; The Decorator Pattern;118
11.1.1; Closures;123
11.1.2; Retaining Function __name__ and __doc__ Attributes;124
11.2; Decorating Classes;128
11.3; Parting Shots;131
11.4; Exercises;131
12;Chapter 8: Facade Pattern;132
12.1; Point of Sale Example;132
12.2; Systems Evolution;136
12.3; What Sets the Facade Pattern Apart;138
12.4; Parting Shots;141
12.5; Exercises;141
13;Chapter 9: Proxy Pattern;142
13.1; Memoization;142
13.2; The Proxy Pattern;145
13.2.1; Remote Proxy;148
13.2.2; Virtual Proxy;148
13.2.3; Protection Proxy;149
13.3; Parting Shots;149
13.4; Exercises;150
14;Chapter 10: Chain of Responsibility Pattern;151
14.1; Setting Up a WSGI Server;153
14.2; Authentication Headers;154
14.3; The Chain of Responsibility Pattern;158
14.4; Implementing Chain of Responsibility in Our Project;162
14.5; A More Pythonic Implementation;167
14.6; Parting Shots;172
14.7; Exercises;173
15;Chapter 11: Command Pattern;174
15.1; Controlling the Turtle;174
15.2; The Command Pattern;176
15.3; Parting Shots;184
15.4; Exercises;184
16;Chapter 12: Interpreter Pattern;185
16.1; Domain-Specific Languages;185
16.1.1; Advantages of DSLs;189
16.1.2; Disadvantages of DSLs;189
16.1.3; Composite Pattern;194
16.1.4; Internal DSL Implementation Using the Composite Pattern;195
16.2; Implementing the Interpreter Pattern;200
16.3; Parting Shots;207
16.4; Exercises;207
17;Chapter 13: Iterator Pattern;209
17.1; Python Internal Implementation of the Iterator Pattern;212
17.1.1; Itertools;219
17.1.2; Generator Functions;220
17.1.3; Generator Expression;222
17.2; Parting Shots;223
17.3; Exercises;223
18;Chapter 14: Observer Pattern;224
18.1; Parting Shots;241
18.2; Exercises;242
19;Chapter 15: State Pattern;243
19.1; State Pattern;246
19.2; Parting Shots;251
19.3; Exercises;252
20;Chapter 16: Strategy Pattern;253
20.1; Parting Shots;258
20.2; Exercises;259
21;Chapter 17: Template Method Pattern;260
21.1; Parting Shots;272
21.2; Exercises;272
22;Chapter 18: Visitor Pattern;274
22.1; The Visitor Pattern;287
22.2; Parting Shots;299
22.3; Exercises;300
23;Chapter 19: Model-View-Controller Pattern;301
23.1; Model-View-Controller Skeleton;305
23.1.1; Controllers;307
23.1.2; Models;308
23.1.3; Views;308
23.1.4; Bringing It All Together;309
23.2; Parting Shots;315
23.3; Exercises;316
24;Chapter 20: Publish–Subscribe Pattern;317
24.1; Distributed Message Sender;324
24.2; Parting Shots;327
24.3; Exercises;328
25;Appendix ADesign Pattern Quick Reference;329
25.1;Quick Checks for the Code;329
25.2;Singleton;330
25.3;Prototype;331
25.4;Factory;331
25.5;Builder;332
25.6;Adapter;333
25.7;Decorator;333
25.8;Facade;334
25.9;Proxy;335
25.10;Chain of Responsibility;336
25.10.1;Alternative;336
25.11;Command;337
25.12;Composite;338
25.13;Interpreter;338
25.14;Iterator;339
25.14.1;Alternative;340
25.15;Observer;340
25.16;State;341
25.17;Strategy;342
25.18;Template Method;342
25.19;Visitor;343
25.20;Model–View–Controller;344
25.21;Publisher–Subscriber;345
25.22;Final Words;346
26;Index;347



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.