OOP is a language with sole aim of modeling complex (real-world) systems
No, sorry, no.
OOP is very good at modeling reality. However, that is not its sole purpose, in fact, we often model very abstract things with OOP.
All those example of “Animal” and stuff you see in OOP courses… probably only make sense in an academic context and in video games (And there we will probably suggest to depart from using inheritance and encapsulation in favor of an Entity-Component-System solution). Still, those example make OOP approachable, even if they focus on the wrong thing.
As any other paradigm, OOP abstracts complexity. Thus, complex systems are not exclusive of OOP either.
And finally OOP is not a language. It is a paradigm. There are OOP languages (plural).
is OOP the only programming paradigm that lets us model complex system?
What if I tell you can implement an OOD (object-oriented design) in language that is not object-oriented? There is a very simple convention: The
this pointer is the first parameter of the methods.
So, you make every method a procedure that takes a pointer to a structure "this" as first parameter, and that structure has all the fields of the object.
Everything static goes to global scope...
You can implement your OOD with that.
Yes, there are ways to do inheritance, even virtual dispatch. Look, objects do not exist in the CPU. At some point all the OOP stuff gets converted to instructions. I cannot possibly go over how it is all done here. Yet, know that having a OOP language can cut a lot of work.
You, of course, would not have any of the protections of OOP (visibility levels, for example). That means you need to be extra careful.
OOP is there to both protect you from yourself (It is there so you do not shoot yourself in the foot) and make things easier (it provides useful abstraction). In fact, I am saying that OOP restricts the things you can do! OOP does not allow you to do anything you could not do without, it just makes it easier and safer.
if No, why is OOP Unique or Super Popular?
It is easy. In particular they start teaching OOP before you do procedural or structured. An object is a noun (or that is what they teach you), and a method is a verb, it reads like prose.
We have no intention to go back to procedural or structured programming if we can help it. With those, it is easier to get things wrong, and we are more productive in OOP.
The way I see it is not so much that OOP is popular, it is that the most popular languages put an emphasis on objects and classes. Companies use them, there is demand for talent, people want to learn them, there are courses to learn them, people use what they learned. Once a language dominates the market it is very hard to take down.
I think you will more interesting answers if you start looking up why functional languages, in particular the early functional languages are not as popular. What I see again and again is people saying it they are hard to understand. My opinion is that lack a neat way to introduce the concepts. You know, an "Animal" class equivalent for functional programming. At least the introductory examples I have seen lack an emotive connection (yes, I don’t even connect with cartoony monads, I haven’t seen a floating 2 in my life).
because, functional programming contains a bunch of function, does that make java a functional language because it contains functions/methods?
Java isn't purely OOP. That part is true... You can do functional programming in Java if you want to. You can do fully OOP in Java if you want to. It is worth noting that the functional aspects of Java are relatively new, and the standard library is chiefly object-oriented.
However, having methods is not what makes a language functional. Methods are part of OOP. If having method were enough to declare something functional, then every OOP language would be functional.
Instead, a functional language should have functions as first class citizens. In a functional language, a function is a value. You can have functions that take functions as parameters. Also functions that return functions. In fact, it is not rare to create functions by combining other functions. And if you really want to, you can store a function in a variable.
There is sugar in Java to mimic those things, however behind the scene a lambda in Java is an object of an anonymous class that implements a method that can be called. Java is OOP first, functional second. Nothing wrong with that.
Yeah, Java is multi-paradigm. Java is functional, concurrent, object-oriented and imperative. You will find that all the popular modern languages are multi-paradigm. That just makes it easier for them to remain popular.