a computer programming model that organizes software design around
data, or objects, rather
than functions and logic.
OBJECT - ORIENTED PROGRAMING
It is a way of thinking about and structuring a program's functionality.
PROGRAMMING PARADIGM
What are the most common programming paradigm today?
OOP
PROCEDURAL PROGRAMMING
FUNCTIONAL PROGRAMMING
These are user-defined data types that act as the blueprint for
individual objects, attributes and
methods.
CLASSES
These are functions that are defined inside a class that describe the behaviors of an object.
METHODS
are defined in the class template and represent the state of an
object. Objects will have data
stored in the attributes field.
ATTRIBUTES
The additional benefits of OOP
SCALABILITY, CODE REUSABILITY, AND EFFICIENCY
The first step in OOP is to collect all of the objects a programmer
wants to manipulate and
identify how they relate to each other.
DATA MODELLING
information is represented as classes that describe the concepts of
the problem
domain and the logic of the application. Classes
define the methods that determine
how information is handled
OOP
the structure of the program is formed by functionality
desired
for the program: the program acts as a step-by-step guide for the
functionality
to be performed.
PROCEDURAL PROGRAMMMING
uses immutable data to tell the program exactly what
to do
FUNCTIONAL PROGRAMMING
this is where the state of an object can, in principle, change with any object method, and that change of state can also affect the working of the methods of other objects.
OOP
This is where the state of the program is maintained in variables and tables, and any methods handle only the values provided to them as parameters.
PROCEDURAL PROGRAMMING
aims to hide complexity from users and show them only relevant information.
ABSTRACTION
helps with data security, allowing you to protect the data stored in
a class from system-wide access. As the name suggests, it safeguards
the internal contents of a class like a
capsule.
ENCAPSULATION
makes it possible to create a child class that inherits the fields
and methods of the parent class. The child class can override the
values and methods of the parent class, but it’s not
necessary.
It can also add new data and functionality to its parent.
INHERITANCE
Parent classes are also called...
SUPERCLASS
Child classes are known...
SUBCLASS
refers to the ability to perform a certain action in different ways.
POLYMORPHISM
it happens when various methods with the same name are present in a class.
METHOD OVERLOADING
occurs when a child class overrides a method of its parent.
METHOD OVERRIDING
means the act of establishing a relationship between two unrelated classes.
ASSOCIATION
s a narrower kind of association. It occurs when there’s a one-way (HAS-A) relationship between the two classes we associate through their objects
AGGREGATION
a stricter form of aggregation. It occurs when the two classes you associate are mutually dependent and can’t exist without each other.
COMPOSITION
a standardized modeling language consisting of an integrated set of diagrams, developed to help system and software developers for specifying, visualizing, constructing, and documenting the artifacts of software systems, as well as for business modeling and other non-software systems.
Unified Modeling Language (UML)
how to instantiate an object?
className ObjName = new className ();
what keyword to use in order to prevent a class attribute from being overridden
final keyword
We can create our own method based on our
requirements.
User-defined Methods
These are built-in methods in Java that are available
to use.
Standard Library Methods
It defines access types whether the method is public, private, and so on.
MODIFIER
We use this word so it can be accessed without creating objects
static
These are values passed to a method. We can pass any
number of
arguments to a method.
parameters
- It specifies what type of value a method returns. For example if a method has an int return type then it returns an integer value
returnType
- It is an identifier that is used to refer to the particular method in a program.
methodName
- It includes the programming statements that are used to perform some tasks. The method body is enclosed inside the curly braces { }.
methodBody
how to create method?
publicvoid sing () {
System.out.println("lalalaalalala");
}
used to get the value of a private field
Accessors/getter
used to set the value of a private
field
Mutators/setter
how to implement getter ?
public String getName() {
return name;
}
how to implement setter?
public void setName (String newName) {
this.name = newName;
}
It just signals to the compiler that it is the field named number that is being referred to.
this.
what keyword use when implementing inheritance?
extends
used to call the method of the parent class from the method of the child class. The method of the parent class will be called using this keyword.
super
type of inheritance that extends from a single superclass.
single inheritance
type of inheritance extends from a superclass and then the same subclass acts as a superclass for another class.
multi-level inheritance
type of inheritance where multiple subclasses extend from a single superclass
hierarchical inheritance
type of inheritance a single subclass extends from multiple superclasses.
multiple inheritance
a combination of hierarchical and multiple inheritance,
where a
class inherits from multiple classes, some of which are derived from a
common base class.
hybrid inheritance
An abstract method is a method without a
body, and it is
declared using the "_____________" keyword.
abstract
A variable is called __________ if it refers to different values under different conditions.
polymorphic
what keyword to create an interface in Java.
interface
We use the __________ keyword to
implement an interface
implements
what do we called this method where we can now add methods with implementation inside an interface
default method