### Week 13: Introduction to Object Oriented Programming in Python
>By Akinlade Temitope Victory
This week marked the beginning of our journey into Python’s Object-Oriented Programming (OOP). OOP is a method of organizing programs by grouping related data and behaviors into reusable units known as **classes** and **objects**. This approach makes code easier to maintain, reuse, and expand by modeling real-world entities and their interactions.
#### FIELDS
Fields are variables that store data inside a class or object. For example, they can hold details such as a person’s name, age, or address.
#### METHODS
Methods are functions defined within a class that describe what the object can do. For instance, a `bark()` method inside a `Dog` class represents the behavior of a dog.
#### INSTANCES
An instance is a concrete version of a class. When a class is called to create an object, the outcome is an instance, and each instance maintains its own data.
#### OBJECTS
Objects are the actual entities produced from a class. They combine both fields (data) and methods (behavior) into a single unit that can be used in a program.
#### CLASSES
A class is the **blueprint or template** from which objects are created. While the class itself outlines what fields and methods its objects will have, it does not hold actual data until an object (or instance) is created.
#### ATTRIBUTES
Attributes are the properties tied to an object. They can represent the values held in fields or the behaviors defined through methods.
#### CLASS VARIABLES
Class variables are defined inside a class but outside of its methods. These variables are shared across all objects of the class. If one object modifies the value of a class variable, the change will be reflected in all other objects.
#### INSTANCE VARIABLES
Instance variables belong to a particular object and are usually defined within the constructor using self. Each object has its own copy, so changes made in one instance do not impact others.
#### CONSTRUCTOR METHOD (`__init__`)
We also covered the **constructor method** in Python, which is a special function named `__init__`. It is automatically executed whenever a new object is instantiated from a class. Its primary role is to initialize the object’s attributes with values.
**Example:**
```python
class Student:
def __init__(self, name, age):
self.name = name
self.age = age
student1 = Student("Alice", 20)
print(student1.name) # Output: Alice
print(student1.age) # Output: 20
```
#### CONCLUSION
My introduction to Python Object-Oriented Programming (OOP) has given me a strong understanding of how to structure programs with classes and objects. Learning the concepts of fields, methods, instances, objects, classes, and attributes has helped me see how programs can be built in a modular and reusable way.
Exploring constructors, class variables, and instance variables also showed me the importance of initializing data properly and knowing when to share or separate data between objects.