Book Image

Learning Object-Oriented Programming

By : Gaston C. Hillar
Book Image

Learning Object-Oriented Programming

By: Gaston C. Hillar

Overview of this book

Table of Contents (16 chapters)
Learning Object-Oriented Programming
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Organizing object-oriented code in Python


Python makes it easy to logically organize object-oriented code with modules. We will work with a hierarchy of folders to organize the code of an application that allows you to create and furnish house floor plans. Then, we will use code from different folders and the source files of Python.

Working with source files organized in folders

We will create the following six folders to organize the code in our house floor plan layout application. Then, we will add subfolders and the source files of Python to each of the previously created folders:

  • Build

  • Decorate

  • Furnish

  • General

  • Landscape

  • Outdoor

We will include all the base classes in the general folder. The following lines show the code for the general/floor_plan_element.py Python source file that declares a FloorPlanElement base class. We will use this class as the superclass for all the classes that specialize the floor plan element:

class FloorPlanElement:
    category = "Undefined"
    description...