Object-Oriented Programming: Difference between revisions
Line 7: | Line 7: | ||
=Overview= | =Overview= | ||
Object-oriented programming is first and foremost about message passing between [[#Class|class]] [[#Instances|instances]]. | Object-oriented programming is first and foremost about message passing between [[#Class|class]] [[#Instances|instances]]. | ||
=Object-Oriented Design= | |||
In software development, design is often assumed to happen '''before''' programming. | |||
=Object-Oriented Programming vs Functional Programming= | =Object-Oriented Programming vs Functional Programming= |
Revision as of 19:27, 26 July 2022
Internal
Overview
Object-oriented programming is first and foremost about message passing between class instances.
Object-Oriented Design
In software development, design is often assumed to happen before programming.
Object-Oriented Programming vs Functional Programming
Class
A class represents a type of thing and concept. Classes defines state - what kind of information, or attributes they can store. Classes also define behavior, or methods.
Objects
An object is a specific instance of a class.
Inheritance
The inheritance implies that there are classes that are very generic, and other classes that are specific. The specific classes can inherit specific attributes and behavior from generic classes, and they can also have specific attributes and behaviors that are particular to them, and to no one else. Thus, classes form hierarchies.
Parent types are called superclasses. Subtypes are called subclasses.
The motivation behind inheritance is code reusability. If something that is generally applicable to a set of classes, that belongs into the superclass, which can be then inherited.