How to Make Mistakes in Python by Mike Pirnat
Author:Mike Pirnat
Language: eng
Format: mobi, epub, pdf
Publisher: O'Reilly Media, Inc.
Published: 2015-10-02T04:00:00+00:00
God Objects and God Methods
A well-behaved class or method should have a strictly limited set of responsibilities, preferably as close to one as possible (in accordance with the Single Responsibility Principle), and should only contain whatever knowledge or data it needs to fulfill its limited role. All classes and methods start this way, simple and innocent, but we may find it convenient or expedient to grow these entities as our requirements evolve. When a class or method has accumulated too much knowledge or too many responsibilities, its role in the system becomes practically godlike: it has become all-encompassing, all-seeing, and all-doing, and many other entities will end up being tightly coupled to it in order to get anything done. Like big banks in the autumn of 2008, our god objects and god methods are too big to maintain, yet too big to fail.
These are pretty easy to spot: we’re looking for large modules, large classes, classes with many methods, and long methods or functions. There are a couple of different ways to go about this.
Pylint will by default complain about modules longer than 1000 lines and functions longer than 50 lines (and you can adjust these values as needed), but you have to look carefully at its voluminous output to make sure you don’t miss these warnings. WingIDE and Komodo integrate with Pylint for code inspection, so they’ll also help you find these problems. Curiously, while PyCharm offers code inspection that covers many of the same issues that Pylint does, it doesn’t include warnings about module or function length.
If you aren’t someone who enjoys working with an IDE, you can use some Unix command-line kung fu to identify potential sources of godlike trouble:
Download
How to Make Mistakes in Python by Mike Pirnat.epub
How to Make Mistakes in Python by Mike Pirnat.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
What's Done in Darkness by Kayla Perrin(26529)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19009)
The Fifty Shades Trilogy & Grey by E L James(18963)
Shot Through the Heart by Mercy Celeste(18882)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(16991)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16879)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16807)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16705)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16333)
The Subtle Art of Not Giving a F*ck by Mark Manson(14263)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14072)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13432)
Scorched Earth by Nick Kyme(12716)
Drei Generationen auf dem Jakobsweg by Stein Pia(10925)
Suna by Ziefle Pia(10847)
Scythe by Neal Shusterman(10273)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9479)
Successful Proposal Strategies for Small Businesses: Using Knowledge Management ot Win Govenment, Private Sector, and International Contracts 3rd Edition by Robert Frey(9317)
This is Going to Hurt by Adam Kay(9107)
