semis Flashcards
(39 cards)
a way to classify programming languages based on their features
programming paradigm
two main paradigm
- Procedural programming
- Object Oriented Programming
OOP
Object Oriented Programming
a programming paradigm based on the concept of “objects”
Object Orented Programming
OBJECTS can contain:
- data(attributes/ properties)
- methods(functions or behaviors)
real life analogy, identify which is the attributes and methods
1. color, brand, speed
2. drive(), stop(), honk()
- attributes
- methods
4 pillars of OOP
- encapsulation
- abstraction
- inheritance
-polymorphism
bundling data and methods into a single unit(class)
encapsulation
t/f: encapsulation protects data from unauthorized access
true
private fields with public getters/setter
encapsulation
hiding complex implementation, showing only essential features
abstraction
you use a tv remote without knowing how it works
abstraction
- one interface, many forms
- a method behaves differently depending on the object
inheritance
draw() method behaves differently in circle, square
inheritance
Allows different classes to be treated as instances of the same class through method overriding.
polymorphism
why used OOP
- code reusability
- easier to debug and maintain
- better organization
- closer to real-world modeling
a paradigm used to develop complex software systems by organizing problems into objects
object-oriented programming
combining data(attributes) and methods(functions) into one unit(class)
encapsulation
promotes code reuse and logical hierarchy
inheritance
t/f: encapsulation is a protective layer that ensures data integrity and restricts unauthorized access
true
type of paradigms: Encapsulation can be performed through modularization, which groups data and functions into
procedures or functions. Information hiding can be implemented by careful function design.
procedural programming
types of paradigm: prioritizes immutability, but
developers can still employ encapsulation
by constructing higher-order functions that
bundle data and behavior
Functional
programming
how encapsulation works
- declare data members as private
- provide public methods (getter and setters)
- implements data validation
benefits of encapsulation
- data protection
- security
- code reusabality
- maintainability