aliases:
tags: Type/Tech,area/tech/dev,proto
from: []
related: []
contra: []
to: []
dateCreated: 2021-10-25, 17:30
dateModified: 2024-01-19, 11:43
version: 1.0
publish: true
Object-Oriented Programming (OOP) is a programming paradigm based on the concept of objects, which can contain data and code: data in the form of fields, and code in the form of procedures. | |
---|---|
wikipedia:: Object-oriented programming |
"the focus is on the creation of objects which contain both data and functionality together. Usually, each object definition corresponds to some object or concept in the real world and the functions that operate on that object correspond to the ways we interact with real-world objects."
Uses objects that are data structures containing data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.
Most popular OOP are class-based, meaning that objects are instances of classes, which also determine their types.
Class vs. type[edit]
In its most casual usage, people often refer to the "class" of an object, but narrowly speaking objects have type: the interface, namely the types of member variables, the signatures of member functions (methods), and properties these satisfy. At the same time, a class has an implementation (specifically the implementation of the methods), and can create objects of a given type, with a given implementation.[5] In the terms of type theory, a class is an implementation—a concrete data structure and collection of subroutines—while a type is an interface. Different (concrete) classes can produce objects of the same (abstract) type (depending on type system); for example, the type Stack might be implemented with two classes – SmallStack (fast for small stacks, but scales poorly) and ScalableStack (scales well but high overhead for small stacks). Similarly, a given class may have several different constructors.