A programming paradigm is a style, or “way, ” of programming. Programming paradigms differ from one another based on the features and the style they support. There are several features that determine a programming paradigm such as modularity, objects, interrupts or events, control flow etc. Every programming paradigm has its own advantage so, it better to know where to use it before actually using it.
According to the answer given in stack overflow,
Object-oriented languages are good when you have a fixed set of operations on things, and as your code evolves, you primarily add new things. This can be accomplished by adding new classes which implement existing methods, and the existing classes are left alone.
Functional languages are good when you have a fixed set of things, and as your code evolves, you primarily add new operations on existing things. This can be accomplished by adding new functions which compute with existing data types, and the existing functions are left alone.
It is also possible to use both the programming paradigms according to our own need. As we have got languages like python, java, etc that supports both object oriented concept and are also functional by supporting various inbuilt functions.
Functional Programming vs Object Oriented Programming
|Functional Programming||Object Oriented Programming|
|This programming paradigm emphasizes on the use of functions where each function performs a specific task.||This programming paradigm is based on object oriented concept. Classes are used where instance of objects are created|
|Fundamental elements used are variables and functions.The data in the functions are immutable(cannot be changed after creation).||Fundamental elements used are objects and methods and the data used here are mutable data.|
|Importance is not given to data but to functions.||Importance is given to data rather than procedures.|
|It follows declarative programming model.||It follows imperative programming model.|
|It uses recursion for iteration.||It uses loops for iteration.|
|It is parallel programming supported.||It does not support parallel programming.|
|The statements in this programming paradigm does not need to follow a particular order while execution.||The statements in this programming paradigm need to follow a order i.e., bottom up approach while execution.|
|Does not have any access specifier.||Has three access specifiers namely, Public, Private and Protected.|
|To add new data and functions is not so easy.||Provides and easy way to add new data and functions.|
|No data hiding is possible. Hence, Security is not possible.||Provides data hiding. Hense, secured programs are possible.|
- Differences between Functional and Non-functional Testing
- Difference between Function Oriented Design and Object Oriented Design
- Difference between Row oriented and Column oriented data stores in DBMS
- Differences between Procedural and Object Oriented Programming
- Difference between Structured and Object-Oriented Analysis
- Difference between Functional Testing and Implementational Testing Approach
- Difference between Project Management and Functional Management
- Object-Oriented Programming in Ruby | Set 1
- Object Oriented Programming in Ruby | Set-2
- Best Practices of Object Oriented Programming (OOP)
- Introduction of Object Oriented Programming
- Brief Overview & Comparison of Object-Oriented Programming from C to Java
- Types of Models in Object Oriented Modeling and Design
- Difference between Connection-oriented and Connection-less Services
- Difference between service-oriented (SOA) and Micro service Architecture (MSA)
- What is COBOL(Common Business Oriented Language)?
- Difference between Component and Object
- Difference between Entity and Object
- Difference between Source Code and Object Code
- What's the difference between Scripting and Programming Languages?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : anonymous007