Jump to ratings and reviews
Rate this book

Aprendendo padrões de projeto em Python

Rate this book
Com um foco cada vez maior na otimização dos níveis de arquitetura e design de software, é importante que os arquitetos de software pensem em otimizações na criação de objetos, na estrutura do código e na interação entre objetos nesses níveis. Isso garante que o custo da manutenção de software seja baixo e o código seja facilmente reutilizado ou adaptável a mudanças. Aprendendo padrões de projeto em Python ajudará você a implementar cenários do mundo real com a versão mais recente de Python, a v3.5. Começaremos apresentando os padrões de projeto do ponto de vista de Python. À medida que avançar no livro, você conhecerá os padrões Singleton, Factory e Façade em detalhes. Depois disso, veremos como controlar o acesso a objetos com o padrão Proxy. O livro também inclui os padrões Observer, Command e Compound. Ao chegar ao final desta obra, você terá melhorado suas habilidades profissionais em arquitetura, design e desenvolvimento de software.

168 pages, Paperback

Published September 1, 2016

13 people are currently reading
36 people want to read

About the author

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
5 (9%)
4 stars
10 (18%)
3 stars
18 (33%)
2 stars
10 (18%)
1 star
10 (18%)
Displaying 1 - 8 of 8 reviews
5 reviews
February 20, 2017
A very bad book on the topic of design patterns in python.

Where should I begin? I think I should start from explaining where programming design patterns come from. In order to do that, I need to say a few words about another book before I can review this one.

Design patterns were first catalogued and thoroughly described in the iconic book "Design Patterns: Elements of Reusable Object-Oriented Software", written by authors collectively known as the Gang of Four (GoF for short). GoF book did a very good job of listing and explaining all design patterns and providing the reader with real-world examples (that is, examples from software that was actually written, and whose authors documented the problems they had and solutions they found).

However, GoF book mainly targets C++ and Smalltalk, and it's really dated. The core principles described in the book stay the same, but some implementations can be simplified (due to the modern changes made to C++ language standard), and thus the book needs some editing to provide value for modern C++ programmers.

And, of course, if you use language other than C++ (or Smalltalk), you should rely on tools provided by your language. Thus, solutions provided for C++ are usually not very useful for python, due to the many differences between these languages. This explains the need for a new book that would describe python design patterns and illustrate them with pythonic implementations.

So this is what the book being reviewed should deliver. It promises to do so, but fails miserably.

The book claims to provide us with "real-world scenarios". When I see "real-world scenarios", I instantly start thinking about code that has at least some resemblance to real world software, that is, something that may potentially run in production. It doesn't have to be 100% realistic, as this is an educational book, and I am not asking to quote the entirety of GitHub, but still, I think it is possible to take some existing software, analyze relations between classes and objects in this software, and write examples that resemble something that would be written in real life. You know, kind of like GoF did in their book.

But no, the author has something completely different on his mind. By "real-world scenarios", author means "some situation that happens in real life, not necessarily in the software world". For example, the author illustrates that Facade design pattern is essentially like a real-life wedding ceremony... with you being the client, various service providers (florist, hotelier, musician, etc.) being the subsytems, and Facade being the event manager who handles all the subsystems to make all the marriage arrangements.

Actually, this is a good example to illustrate the idea behind the pattern, but this is very far from being a "real-world scenario" in terms of software. It's even worse when author illustrates abstract factories using pizza places as an example. The code provided is ugly, and it's very unlikely you'll ever see something like this in "real-world scenarios".

By the way, It's so ironic to see non-pythonic code in a python book... It's ok when authors omit some PEP8 requirements (for example, blank lines) and WARN THE READERS THEY DO SO for some reason (to prevent number of pages from bloating, for example). But the author names his methods with mixedCase, which is not compliant with PEP8. What does PEP8 say on the topic? "Function names should be lowercase, with words separated by underscores as necessary to improve readability. mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility". Since the author, presumably, wrote the book from scratch, and in the modern day and age, there was no excuse to violate PEP8.

And oh, almost forgot. The author feels the urgent need to recap material we learned so often, I can safely claim that approx. 40% of book material is written with the intent of making the book look bigger than it originally was. If you take an arbitrary chapter, it starts with 1) short recap of previous chapter 2) some useless blabber about what we're going to learn 3) the actual material, that is really scarce, and 4) recap of what we read. So, in general, if you read a chapter, you're going to see a recap at the end of this chapter, in the beginning of the next one, and in the form of some useless chit-chat right before the material begins, I kid you not. Some people say that repeating material is essential to learning it. No. In case of this book, all these recaps are so mind-numbingly dumb, it is unlikely you will find any real information between those recaps, and it actually renders all the provided points absolutely useless.

Recaps, recaps everywhere. Ugly code. Real-world scenarios related to weddings and pizzas, not to real-world software. PEP8 violations. This is the book you didn't deserve.

Does this book have any value? Well, if you're completely new to design patterns, it may be of some use to you to get acquainted with design patterns, but I still don't recommend it for all of the reasons listed above. Instead, google "python design patterns github" - you will find an absolutely recap-less collection of design patterns implemented in python. And, if you really intend to understand the idea behind design patterns, learn some C++ and read the GoF book. It's still good.

And speaking of this book - avoid it. Too much water and too little information, definitely not worth the money.
Profile Image for Andy Smith.
5 reviews
January 19, 2021
While the examples in the book are (sort of) adequate, the overall quality is what I'd expect from a series of blog posts - it's littered with spelling mistakes and typos. While I accept that the author's first language probably isn't English, these kinds of things should have been picked up by the editor. The book just doesn't flow very well at all and is pretty hard to read as a result.

As noted previously, the examples are okay, but they're not explained particularly well and in many cases are overly contrived. Sure, it can difficult sometimes to come up with a solid real world example but I'd expect better from a book. In addition, some of the coding choices are a bit odd - for example, the book clearly (and repeatedly) points out that it's using Python 3.5, but the print() statements use the Python 2.x style.

Overall, I would avoid this book. I read this to refresh my memory on a few of the patterns and so I had the benefit of already being familiar with the subject matter and I still found it confusing at times. I imagine that someone trying to learn how to apply these to Python for the first time would find it particularly difficult to follow along.

If you're interested in learning how to apply various design patterns in Python, I'd recommend instead checking out either https://python-patterns.guide/ or https://python-3-patterns-idioms-test....
Profile Image for Strong Extraordinary Dreams.
592 reviews30 followers
June 5, 2017
This is a book cobbled together from postings and internet writings and the like. It's almost painful.

Further, it hasn't been proofread "in python the concept of encapculsation is not implicit" with the 'not' being incorrect - the direct opposite is true. Also "clients can't change an object's internal state directly" and then "of course, accessibility can be made private by affixing __ in the variable name'.

All round, a very, very shitty book. It looks like a series of (badly written) lecture notes.
Profile Image for Nickolai.
942 reviews8 followers
April 2, 2024
Книгу не рекомендую. Во-первых, очень поверхностная, лишь мазками пробегает по отдельным паттернам. Целостной картины не выходит. Во-вторых, порой автор чересчур усложняет описание либо, наоборот, упрощает его до примитивных понятий, слабо соотносящихся с практикой. Золотой середины, увы, не удалось найти.
Profile Image for Edward Vanbuskirk.
27 reviews
Read
November 24, 2017
Had the info, but did not use 'real world examples' as it boasts. Feels hastily put together and poorly edited.
Profile Image for Alan.
63 reviews13 followers
February 17, 2021
Usei este livro na tradução em português como referência para as aulas de linguagem de programação onde ensinei tópicos de orientação a objetos com Python. O livro é ok como referência para implementação de padrões usando Python, é legal para pegar algumas sacadas de metaprogramação e expressões idiomáticas do Python, mas o desenvolvimento do texto é horrível.
Displaying 1 - 8 of 8 reviews

Can't find what you're looking for?

Get help and learn more about the design.