OOPs vs FOPs
Which one is the best…….
OOPS
Object-oriented programming is a fundamental part of web and software development and it is difficult to say people use any other method other than this.
It appeared first in the 1980s.
These days, major software and web development are performed using OOP. In languages like JAVA and C++, one cannot imagine developing software without the OOP method. The same thing is for web development also languages like Python, PHP, RUBY, etc. widely use this method.
FUNDAMENTA BUILDING BLOCK OF OOP
. CLASSES
. OBJECTS
. METHODS
. ATTRIBUTES
The advantages of using object-oriented programming:
Easy Troubleshooting
When you are working with an Object-oriented programming language, one knows exactly where to look if something goes wrong in the program. One does not have to go line by line.
That’s the beauty of encapsulation. Objects are self-contained, and each bit of functionality does its own thing while leaving the other bits alone.
Reusability of Code
In this case Inheritance concept comes to play. Suppose you have a bouquet and your other friend wants a rose bouquet and another friend wants a yellow rose bouquet. In this case, everyone wants something different but the commodity which is the same is the bouquet. We just have to create one generic class ie Bouquet, and then have to define the sub-classes ie. rose bouquet and yellow bouquet, the rest will be inherited from the generic class’s trait.
Due to this we do not have to write the code over and over and can use the same code multiple times.
Flexibility in use
Using the same example of the “Rosebouquet” and the “yellowbouqute”. Suppose one friend wants to gift it to his girlfriend so it will become “redrosegift_girlfirend” and another one ie. the “yellowbouquetgift_friend” to a friend. In this case only one function
will be required ie gift function ie. redrosebouquet.gift(giftgirlfriend) or yellobouquet.gift(giftfriend).
Problem Solving
Many people avoid learning OOP because the learning curve seems steeper than that for top-down programming. But take the time to master OOP and you’ll find it’s the easier, more intuitive approach for developing big projects.
It is ultimate to tackle huge problems and break them down into smaller solvable pieces.
For each problem, one can write a class containing functionality according to the need and use the same class over and over, which will make the program even quicker and solve the issue at a faster rate.
IF YOU ARE HAVING TROUBLE IN LEARNING OOPS CONCEPT JUST VISIT www.thecodepanda.in
It has all sorts of interactive methods to increase your understanding of the OOPs concept.
FOPs
This type of programming language is designed to handle symbolic computation and list processing applications.
It is based on mathematical functions. Some of the popular languages are Python, Erlang, Haskell, Clojure, etc.
Types:
- Pure Functional Languages − These types of functional languages support only the functional paradigms. For example − Haskell.
- Impure Functional Languages − These types of functional languages support the functional paradigms and imperative style programming. For example − LISP.
Advantages of Function oriented Programming
- Bugs-Free Code − Functional programming does not support state, so there are no side-effect results and we can write error-free codes.
- Efficient Parallel Programming − Functional programming languages have NO Mutable state, so there are no state-change issues. One can program “Functions” to work parallel as “instructions”. Such codes support easy reusability and testability.
- Efficiency − Functional programs consist of independent units that can run concurrently. As a result, such programs are more efficient.
- Supports Nested Functions − Functional programming supports Nested Functions.
- Lazy Evaluation − Functional programming supports Lazy Functional Constructs like Lazy Lists, Lazy Maps, etc.