Object-Oriented Principles Flashcards
Abstraction
Is a mechanism and Practice to reduce and factor out details so that one can focus on few concepts at a time
Is a design technique that focuses on the essential aspects of an entity and ignores or conceals less important or non-essential aspects.
Separation
Software Design is the separation of an Interface from an Implementation.
The interface is viewed as the visible, external aspect of the software that must be understood to use the software.
The implementation is viewed as the hidden, internal aspect of the software that is important only to the implementer.
Encapsulation
Is the ability to provide user with a well-defined interface to a set of functions in a way that hides their internal working. In OOP, it is the technique of keeping together data structures and the methods(procedures) that act on them.
Encapsulation refers to the bundling of data with the methods that operate on that data.
Information Hiding
In programming, the process of hiding the details of an object or function. Information hiding is a powerful programming technique because it reduces complexity. One of the chief mechanisms for hiding information is encapsulation – combining elements to create a larger entity. The programmer can then focus on the new object w/o worrying about the hidden details
Information hiding involves “hiding” the details of the design, algorithms, data structures, etc. Of a class that might possibly change over time.
This is done by publicly exposing only those methods whose existence is not likely to change, and then “hiding” (making private) all the remaining implementation details.
Inheritance
In object technology, the ability of one class of the objects to inherit properties from a higher class.
is an OOP that allows you to take the implementation of any given clas and build a new class based on that implementation.
The subclass can also extends or replace behavior in the superclass by “overriding” methods that were already implemented in the superclass. The inheritance hierarchy can be many levels deep.
Polymorphism
Is the ability of a generalized request (message) to produce different result based on the object that it is sent to.
Is the idea of allowing the same code to be used w. Different classes of data, resulting in more general and abstract implementations.
The concept of polymorphism applies to functions as well as types.
A function that can evaluate to and be applies to values of different types is known as a polymorphic function.
A data attribute that contain elements of an unspecified type is known as polymorphic data attribute.
Composition
is a technique for building a new object from one or more existing objects that support some or all of the new objects’s required interfaces
Composition can be defined as an organized collection of components (i.e., objects) interacting to achieve a coherent, common behavior.
The “part-whole” relationship is often expressed as a “has-a relationship”.
Interface
A Java keyword used to define a collection of method definitions and constant values. An interface can later be implemented by classes that define this interface with the “implements” keywords.
In general, an interface is a device or a system that unrelated entities use to interact.
Within the Java language, an interface is a type, just as a class is a type.
Like class, an interface defines methods. Unlike classes, an interface never implements methods; instead, classes implements the interface must implements the methods defined by the interface. A class can implement multiple interfaces.
Delegation
Delegation involves the transfer to other of responsibility for carrying out certain tasks, functions or decisions.
Delegation can be viewed as a relationship b/w objects where one object where one object forward certain method class another object, called its “delegate”.
The primary advantages of delegation is run-time flexibility - the delegate can easily be changed at run-time.