PROGRAMMING LANUAGE - LESSON 5

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 11:02 AM on 5/31/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

25 Terms

1
New cards

WHAT IS OBJECT – ORIENTED

PROGRAMMING (OOP)?

Object-oriented programming (OOP) is a software

development paradigm which encourages sculpting

desired entities with properties and methods in

named classes to create applications.

OOP relies on two major concepts: the CLASS and

the OBJECT - these foundational concepts applied in

code enable us to build applications.

2
New cards

WHAT IS OBJECT – ORIENTED

PROGRAMMING (OOP)?

Classes that have been instantiated in our code

become objects that can interact with one another

to perform the desired functions of the application.

Object oriented programming was created to guide

the creation of better software, by achieving easier

maintenance and reusability.

3
New cards

BENEFITS OF USING OOP: MODULARITY

  • OOP encourages the organization of software into discrete,

    self-contained units (classes and objects).

  • This modularity makes it easier to manage, understand, and modify

code. Each class can be developed and tested independently, promoting

cleaner and more organized codebases.

4
New cards

BENEFITS OF USING OOP: REUSABILITY

  • OOP allows for the reuse of existing classes through inheritance and

    polymorphism.

  • Code reuse reduces redundancy, saves development time, and ensures consistency across the application. For instance, a well-designed Vehicle class can be reused for creating Car, Bike, and Truck classes.

5
New cards

BENEFITS OF USING OOP: EXTENSIBILITY

OOP promotes the creation of systems that are easy to extend with new

features.

When new features or requirements arise, new classes can be added

with minimal impact on existing code. For example, adding a new

Airplane class to an existing hierarchy of Vehicle classes requires little to

no changes to existing classes.

6
New cards

BENEFITS OF USING OOP: MAINTAINABILITY

-The principles of encapsulation and abstraction help to create more

maintainable code.

-Encapsulation keeps data safe from outside interference and misuse,

making it easier to track and fix bugs. Abstraction hides complex details,

allowing developers to work with high-level interfaces, simplifying

maintenance and updates.

7
New cards

BENEFITS OF USING OOP: FLEXIBILITY AND SCALABILITY

-OOP systems can be easily adapted and scaled as new requirements

emerge.

-Polymorphism allows objects to be treated as instances of their parent

class, making it easier to introduce new subclasses without altering

existing code. This flexibility supports scalability and adaptability in

large and complex systems.

8
New cards

BENEFITS OF USING OOP: IMPROVED COLLABORATION

-OOP allows multiple developers to work on different parts of a project

simultaneously.

-By breaking down a project into classes and objects, teams can divide

the work more effectively, reducing conflicts and improving

collaboration. Each team member can focus on a specific class or set of

classes without affecting others.

9
New cards

BENEFITS OF USING OOP: REAL-WORLD MODELING

-OOP provides a clear structure for modeling real-world entities and

relationships.

-By using classes and objects to represent real-world entities (e.g.,

Person, Account, Transaction), OOP makes it easier to understand and

design complex systems that mimic real-world scenarios.

10
New cards

BENEFITS OF USING OOP: ENHANCED CODE READABILITY AND DOCUMENTATION

-OOP promotes writing self-explanatory and well-documented code.

-Well-defined classes and methods make the code more readable and

easier to understand. This clarity is beneficial for both current

development and future maintenance, as new developers can quickly

grasp the structure and functionality of the code.

11
New cards

OBJECT ORIENTED PROGRAMMING

VS.

PROCEDURAL PROGRAMMING

OBJECT ORIENTED PROGRAMMING

  • Bottom Up Approach

  • Divided into objects

  • Has Access Modifiers

  • Objects can move and communicate with other through member function

  • More secure

  • Supports overloading

PROCEDURAL PROGRAMMING

  • Top Down Approach

  • Divided into functions

  • Doesnt have access Modifiers

  • Data can move freely from function to function in the system

  • Less Secure

  • Does not support overloading

12
New cards

STRUCTURE OF OBJECT ORIENTED

PROGRAMMING:

Object-oriented programming contains

various structures, known as the building

blocks of OOP. These structures include:

CLASS

OBJECT

METHOD

ATTRIBUTE

13
New cards

CLASS

A class is a data type that provides a framework for creating objects. You can

define a class to create multiple objects without writing additional code.

14
New cards

OBJECT

In OOP, an object represents an instance, or creation, of a class. Objects define specific data, such as properties and behaviors, to implement code.

15
New cards

METHOD:

A method is a function that performs a task or action. For example, a method may return information about an object's data.

16
New cards

ATTRIBUTE:

This structure stores information about an object and defines its state. You can

define an attribute as part of the class.

17
New cards

4 CONCEPTS OF OOP

  • Encapsulation

  • Abstraction

  • Inheritance

  • Polymorphism

18
New cards

ENCAPSULATION:

  • Encapsulation means to enclose data by containing it within an object. In OOP, encapsulation forms a barrier around data to protect it from the rest of the code.

  • You can perform encapsulation by binding the data and its functions into a class.

  • This action conceals the private details of a class and only exposes the functionality essential for interfacing with it.

  • When a class doesn't allow direct access to its private data, it's well-encapsulated.

19
New cards

ENCAPSULATION Example

  • When creating a class to represent a person, you may define private data, such as the person's Social Security Number.

  • You can encapsulate this data as a private variable in the class, which means outside code can't access it.

  • If you write a method in the person class to perform a bank transaction, the function could access the data variable as necessary.

  • In this example, the person's private data is well-encapsulated within the class.

20
New cards

ABSTRACTION

  • Abstraction refers to using simplified classes, rather than complex implementation code, to access objects.

  • Often, it's easier to design a program when you can separate the interface of a class from its implementation.

  • In OOP, you can abstract the implementation details of a class and present a clean, easy-to-use interface through the class member functions.

  • Abstraction helps isolate the impact of changes made to the code so if an error occurs, the change only affects the implementation details of a class and not the outside code.

21
New cards

ABSTRACTION Example

  • Imagine a payment processing system with different payment methods like credit card, PayPal, and bank transfer.

  • Instead of dealing with the specifics of each payment method in the main system, you create an abstract class Payment with a method process_payment(amount).

  • This method is defined in such a way that any subclass must implement it, but the details of how the payment is processed are hidden.

22
New cards

INHERITANCE:

  • Most object-oriented programming languages support inheritance, enabling a new class to automatically acquire the properties and functions of its parent class.

  • Inheritance facilitates the organization of classes into hierarchies, where a class can have multiple parent or child classes.

  • When a class inherits from a parent class, it gains the properties and behaviors of the parent.

  • The child class can also alter or enhance the parent's functionality. This allows for code reuse without needing to redefine the child class's functions.

23
New cards

INHERITANCE Example

  • For instance, in the animal world, an insect may belong to an insect class.

  • In this class, all insects share similar properties, such as having six legs and an exoskeleton.

  • You can create subclasses for different varieties of insects, such as grasshoppers and ants.

  • These child classes inherit the properties of the insect class, meaning they share those same features.

24
New cards

POLYMORPHISM:

  • Polymorphism refers to creating objects with shared behaviors. In OOP, polymorphism allows for the uniform treatment of classes in a hierarchy.

  • When you write code for objects at the root of the hierarchy, any objects created by a child class within the hierarchy have the same functions.

  • Depending on the type of object, it may execute different behaviors.

25
New cards

POLYMORPHISM Example

  • If you have a class called animal with two child classes, cat and dog, you can create a class function to make a noise.

  • Using polymorphism, you can override this function inherited by the cat and dog child classes. Instead, you can make this function "meow" and "bark" for cat and dog, respectively.

  • Depending on the type of animal object that passes through the interface, it either makes a "meow" or a "bark" noise.