11-3. Attributes and Methods

When we use classes and objects in Python to represent a software process, we can create a program that mimics or handles tasks related to software.

  • Attributes (or variables): These are like characteristics of the process. They hold information about the process.
  • Methods (or functions): These are like actions the process can perform.

When we create an object of the Process class, it represents one specific software process in action. This object has its own set of values for each attribute (characteristic) and can perform actions defined by the methods in the class.

Here's an example to make it clear:

Define a Class: Think of it as creating a blueprint for a software process.

Create an Object: This is like making a specific process using the blueprint.

Use the Object: We can now use this object to perform actions.

Putting It All Together

Here's the complete code for our Process class example: