Practices of the Python Pro

Book description

Professional developers know the many benefits of writing application code that’s clean, well-organized, and easy to maintain. By learning and following established patterns and best practices, you can take your code and your career to a new level.

With Practices of the Python Pro, you’ll learn to design professional-level, clean, easily maintainable software at scale using the incredibly popular programming language, Python. You’ll find easy-to-grok examples that use pseudocode and Python to introduce software development best practices, along with dozens of instantly useful techniques that will help you code like a pro.



About the Technology

Professional-quality code does more than just run without bugs. It’s clean, readable, and easy to maintain. To step up from a capable Python coder to a professional developer, you need to learn industry standards for coding style, application design, and development process. That’s where this book is indispensable.



About the Book

Practices of the Python Pro teaches you to design and write professional-quality software that’s understandable, maintainable, and extensible. Dane Hillard is a Python pro who has helped many dozens of developers make this step, and he knows what it takes. With helpful examples and exercises, he teaches you when, why, and how to modularize your code, how to improve quality by reducing complexity, and much more. Embrace these core principles, and your code will become easier for you and others to read, maintain, and reuse.



What's Inside

  • Organizing large Python projects
  • Achieving the right levels of abstraction
  • Writing clean, reusable code Inheritance and composition
  • Considerations for testing and performance


About the Reader

For readers familiar with the basics of Python, or another OO language.



About the Author

Dane Hillard has spent the majority of his development career using Python to build web applications.



Quotes
A wealth of information on general software architecture and truths that are applicable to any language.
- David T. Kerns, Rincon Research Corporation

Get this book, and begin to write Python code like a professional.
- Davide Cadamuro, BMW Group

This will take a Python developer down a path to becoming a pro.
- Joseph Perenia, Sony Interactive Entertainment

Publisher resources

View/Submit Errata

Table of contents

  1. Copyright
  2. Brief Table of Contents
  3. Table of Contents
  4. Preface
  5. Acknowledgments
  6. About this book
  7. About the Author
  8. About the cover illustration
  9. Part 1. Why it all matters
    1. Chapter 1. The bigger picture
      1. 1.1. Python is an enterprise language
      2. 1.2. Python is a teaching language
      3. 1.3. Design is a process
      4. 1.4. Design enables better software
      5. 1.5. When to invest in design
      6. 1.6. New beginnings
      7. 1.7. Design is democratic
      8. 1.8. How to use this book
      9. Summary
  10. Part 2. Foundations of design
    1. Chapter 2. Separation of concerns
      1. 2.1. Namespacing
      2. 2.2. The hierarchy of separation in Python
      3. Summary
    2. Chapter 3. Abstraction and encapsulation
      1. 3.1. What is abstraction?
      2. 3.2. Encapsulation
      3. 3.3. Try it out
      4. 3.4. Programming styles are an abstraction too
      5. 3.5. Typing, inheritance, and polymorphism
      6. 3.6. Recognizing the wrong abstraction
      7. Summary
    3. Chapter 4. Designing for high performance
      1. 4.1. Hurtling through time and space
      2. 4.2. Performance and data types
      3. 4.3. Make it work, make it right, make it fast
      4. 4.4. Tools
      5. 4.5. Try it out
      6. Summary
    4. Chapter 5. Testing your software
      1. 5.1. What is software testing?
      2. 5.2. Functional testing approaches
      3. 5.3. Statements of fact
      4. 5.4. Unit testing with unittest
      5. 5.5. Testing with pytest
      6. 5.6. Beyond functional testing
      7. 5.7. Test-driven development: A primer
      8. Summary
  11. Part 3. Nailing down large systems
    1. Chapter 6. Separation of concerns in practice
      1. 6.1. A command-line bookmarking application
      2. 6.2. A tour of Bark
      3. 6.3. An initial code structure, by concern
      4. Summary
    2. Chapter 7. Extensibility and flexibility
      1. 7.1. What is extensible code?
      2. 7.2. Solutions for rigidity
      3. 7.3. An exercise in extension
      4. Summary
    3. Chapter 8. The rules (and exceptions) of inheritance
      1. 8.1. The inheritance of programming past
      2. 8.2. The inheritance of programming present
      3. 8.3. Inheritance in Python
      4. 8.4. Inheritance and composition in Bark
      5. Summary
    4. Chapter 9. Keeping things lightweight
      1. 9.1. How big should my class/function/module be?
      2. 9.2. Breaking down complexity
      3. 9.3. Decomposing classes
      4. Summary
    5. Chapter 10. Achieving loose coupling
      1. 10.1. Defining coupling
      2. 10.2. Recognizing coupling
      3. 10.3. Coupling in Bark
      4. 10.4. Addressing coupling
      5. Summary
  12. Part 4. What’s next?
    1. Chapter 11. Onward and upward
      1. 11.1. What now?
      2. 11.2. Design patterns
      3. 11.3. Distributed systems
      4. 11.4. Take a Python deep dive
      5. 11.5. Where you’ve been
      6. Summary
  13. Appendix Installing Python
    1. A.1 What version of Python should I use?
    2. A.2 The “system” Python
    3. A.3 Installing other versions of Python
    4. A.4 Verifying the installation
  14. Index
  15. List of Figures
  16. List of Listings

Product information

  • Title: Practices of the Python Pro
  • Author(s): Dane Hillard
  • Release date: January 2020
  • Publisher(s): Manning Publications
  • ISBN: 9781617296086