Preface

Modular programming is a way of organizing your program's source code. By organizing your code into modules (Python source files) and packages (collections of modules), and then importing those modules and packages into your program, you can keep your programs logically organized and keep potential problems to a minimum.

As your program grows and changes, you will often have to rewrite or expand certain parts of your code. Modular programming techniques help to manage these changes, minimizing side-effects, and keeping your code under control.

As you work with modular programming techniques, you will learn a number of common patterns for using modules and packages, including the divide and conquer approach to programming, the use of abstraction and encapsulation, and the idea of writing extensible modules.

Modular programming techniques are also a great way of sharing your code, either by making it available for other people to use or by reusing your code in another program. Using popular tools such as GitHub and the Python Package Index, you will learn how to publish your code, as well as use code written by other people.

Putting all these techniques together, you will learn how apply "modular thinking" to create better programs. You will see how modules can be used to deal with complexity and change in a large program and how modular programming really is the foundation of good programming technique.

By the end of the book, you will have an excellent understanding of how modules and packages work in Python and how to use them to create high-quality and robust software that can be shared with others.

What this book covers

Chapter 1, Introducing Modular Programming, looks at the ways you can use Python modules and packages to help organize your programs, why it is important to use modular techniques, and how modular programming helps you to deal with the ongoing process of programming.

Chapter 2, Writing Your First Modular Program, introduces the divide and conquer approach to programming and applies this technique to the process of building an inventory control system based on modular programming principles.

Chapter 3, Using Modules and Packages, covers the nuts and bolts of modular programming using Python, including nested packages, package and module initialization techniques, relative imports, choosing what gets imported, and how to deal with circular references.

Chapter 4, Using Modules for Real-World Programming, uses the implementation of a chart-generation library to show how modular techniques help to deal with changing requirements in the best possible way.

Chapter 5, Working with Module Patterns, looks at a number of standard patterns for working with modules and packages, including the divide and conquer technique, abstraction, encapsulation, wrappers, and how to write extensible modules using dynamic imports, plugins, and hooks.

Chapter 6, Creating Reusable Modules, shows how to design and create modules and packages that are intended to be shared with other people.

Chapter 7, Advanced Module Techniques, looks at some of the more distinctive aspects of modular programming in Python, including optional and local imports, tweaking the module search path, "gotchas" to be aware of, how to use modules and packages for rapid application development, working with package globals, package configuration, and package data files.

Chapter 8, Testing and Deploying Modules, examines the concept of unit testing, how to prepare your modules and packages for publication, how to upload and publish your work, and how to make use of modules and packages written by other people.

Chapter 9, Modular Programming as a Foundation for Good Programming Technique, shows how modular techniques help to deal with the ongoing process of programming by dealing with change and managing complexity, and how modular programming techniques help you to be a more effective programmer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.234.24