Class constitute of methods(actions) and attributes (characteristics). Combination of different data, functions, and methods into a single entity called a class. Generic version of an object. Using a laptop as an example, you might build a class that has the generic version of size, height, weight, color of a laptop. Define the class one time.
Object is an instance of a class. The laptop is the object. Create specific versions of this classes using objects. So, each laptop variety will be it’s own object.
Attribute is a characteristic or descriptor of the class. The size, height, weight, color of the laptop you are looking at will be the attributes of that laptop.
Method is an action an object or class can take. The laptop coming on and off, changing laptop price is an action the laptop can take.
OOP is object oriented programming. The process of Building an instance that will combine the Object (laptop), it’s attributes, and methods into a single class will be considered encapsulation and is an example of OOP.
In OOP, encapsulation helps to hide implementation details in a class. Like how sci-kit learn hides Machine Learning implementation details in their classes.
In summary, each class can be a template that has methods and attributes for an object. Then…you can create specific instance of that object that pulls the template methods and attributes from the class and modify it for the specific object in question.
Procedural vs Object-Oriented Programming (OOP).
Procedural programming involves providing lines of instructions that are executed one after the other. Object-Oriented Programming (OOP) involves encapsulating things into methods within a class and building the computer program like an object.
Leave a Comment