Functional Programming vs. Object-Oriented Programming in Java || By Shiva || Part-1

Описание к видео Functional Programming vs. Object-Oriented Programming in Java || By Shiva || Part-1

Functional Programming vs. Object-Oriented Programming in Java

Object-Oriented Programming (OOP) and Functional Programming (FP) are two distinct programming models. Java is primarily an OOP language, but starting with Java 8, it has incorporated functional programming features.

Object-Oriented Programming :-

Object-Oriented Programming (OOP) is a programming style that uses the concept of objects to design and build software. These objects represent real-world entities like cars, animals, or employees. OOP helps make programs more modular, easier to maintain, and more efficient by organizing data and behaviour (methods) into reusable structures called classes.
OOP is built around four main principles:
Encapsulation
Inheritance
Polymorphism
Abstraction
Encapsulation: If a language allows bundling of data and methods in objects and restricts access to an object's data directly, it supports encapsulation. For example, Java provides access modifiers like private, public, and protected to achieve this.
Inheritance: A language must support the ability to create new classes from existing ones, inheriting methods and attributes from a parent class. This allows for code reuse and establishing hierarchies.
Polymorphism: The language should support method overloading and method overriding, allowing objects of different classes to be treated as instances of the same class (through inheritance or interfaces), but still have different behaviours.
Abstraction: The language should allow hiding the internal details of objects and exposing only essential features, typically through abstract classes or interfaces.
if a programming language follows the four key principles of Object-Oriented Programming (OOP)—Encapsulation, Inheritance, Polymorphism, and Abstraction—it can be considered an object-oriented programming language

Комментарии

Информация по комментариям в разработке