0% found this document useful (0 votes)
13 views2 pages

Oop Key Terms and Principles

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Oop Key Terms and Principles

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

OOP key terms and principles Cheat Sheet

by kidchai via cheatography.com/191329/cs/39762/

OOP Inhe​rit​ance ( “is-a” relati​onship)

Object​-or​iented progra​mming is a model that organizes software We can create a new class based on existing class. The new class
design around objects which interact with each other. can reuse the code and behavior of the ancestor class, and it can
also add new features or modify the existing behavior.
Basic terms Types:
• Single (one parent, one child)
Class
• Multi-​level (child is created from another child)
Data type acting like blueprint for individual objects, attrib​utes, and
• Multiple (many parents, one child)
methods. And rules for intera​cting with this entity
• Hierar​chical (one parent, many children)
Objects • Hybrid (child extend several parents, where one or more of them is
Instances of class created with specif​ically defined data. Object has a combin​ation of different types of inheri​tance)
a state (fields) and behavior (methods).
Methods Enca​psu​lat​ion (What happens in Vegas...)

Functions describing behaviors of object. By encaps​ulating a class's variables, only the methods of the class
can access them. It protects the data from external access or modifi​‐
Attributes
cation.
Defined in class template and represent state of object. Object fields.

Poly​mor​phism
Abstract Class | Interface
Subclasses can define their own behaviors and yet share some of
Abstract Class Interface
the same functi​onality of the parent class.
Describes Attrib​utes, Methods
Compile time polymo​rphism -- Method overlo​ading
methods
Class can have more than one method with the same name, but with
For classes With close That could have nothing in
different parameters
connec​tions common
Run time polymo​rphism - Method overriding
(inher​itance)
An instance method in a subclass with the same signature (name,
Multiple   plus the number and the type of its parame​ters) and return type as
Inheri​tance an instance method in the superclass overrides the superc​lass's
Key words Implements Extends interface method.
interface
Extends class Abst​rac​tion

Attributes   We exposing only an object's relevant details to the outside world.

Methods  (abstract  And hiding the implem​ent​ation details. Reduces the code's
without realis​‐ keyword) complexity and makes it easier to use.
ation
Not only Inheri​tance
Methods with   (default keyword)
realis​ation Compos​ition “has-a” (strong connec​tion)

Constr​uctor   Building has a room. Containing object owns it. Objects' lifecycles
are tied (if we destroy the owner object, its members also will be
Access any public (default), private
destroyed with it)
modifiers for methods with realis​ation
Aggreg​ation “has-a” (medium connec​tion)
Сar and its wheels. We can take off the wheels, and they'll still exist.
Doesn't involve owning. Lifecycles of the objects aren't tied: every
one of them can exist indepe​ndently of each other.
Associ​ation objects “know” each other (weak connec​tion)

By kidchai Published 4th August, 2023. Sponsored by CrosswordCheats.com


cheatography.com/kidchai/ Last updated 8th August, 2023. Learn to solve cryptic crosswords!
Page 1 of 2. http://crosswordcheats.com
OOP key terms and principles Cheat Sheet
by kidchai via cheatography.com/191329/cs/39762/

Not only Inheri​tance (cont)

Mother and child. The difference with aggreg​ation is only logical:


whether one of the objects is part of other or not.

SOLID principles

Single Respon​sib​ility
Class should have a single, well-d​efined respon​sib​ility and should not
be respon​sible for multiple things.
Open-C​losed
Software enteties (classes, modules, functions) should be open for
extension but closed for modifi​cation. You should be able to add new
functi​onality to class without changing its existing code.

Liskov Substi​tution
Objects of a subclass should be able to be used in the same way as
objects of parent class without issues.
Interface Segreg​ation
Classes shouldn’t have to implement interfaces that they don't need.
Dependency Inversion
High-level modules (i.e., classes depending on other classes) should
not depend on low-level modules. Both should depend on abstra​‐
ctions. So, it's easier to change implem​ent​ation of low-level module
without affecting high-level module.

By kidchai Published 4th August, 2023. Sponsored by CrosswordCheats.com


cheatography.com/kidchai/ Last updated 8th August, 2023. Learn to solve cryptic crosswords!
Page 2 of 2. http://crosswordcheats.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy