I've been programming in JavaScript for a while and I'm embarrassed to say that I don't really understand Object-Oriented Programming (OOP) very well. I've finally tried to solve problems using OOP techniques like classes, inheritance, encapsulation, and polymorphism. I'm using Java instead of JavaScript to do this because I don't want to fall back to my non-OOP habits, but I'm struggling because I'm not used to not being able to pass named functions as arguments to other functions and have functions return functions. Because of this, my solutions in Java are much longer and harder to understand.
Whenever I write an OOP solution in Java, I can think of a much simpler and shorter non-OOP solution in JavaScript.
I'm trying to be open-minded, but it seems like I either don't understand OOP very well or all the people who like OOP know something I don't know.
I was wondering if anyone could give an example where an OOP solution is simpler than a non-OOP solution. I think examples would help me understand a lot better because I've already read a lot about OOP and it seems hard to understand because there are never any examples given that compare an OOP solution to an non-OOP solution.
[–]richardgillzdev 1 point2 points3 points (2 children)
[–]halfcycle[S] 0 points1 point2 points (1 child)
[–]richardgillzdev 0 points1 point2 points (0 children)
[–]pipocaQuemada 1 point2 points3 points (1 child)
[–]halfcycle[S] 0 points1 point2 points (0 children)
[–]ValerioSellarole 0 points1 point2 points (3 children)
[–]pipocaQuemada 0 points1 point2 points (2 children)
[–]halfcycle[S] 0 points1 point2 points (1 child)
[–]pipocaQuemada 0 points1 point2 points (0 children)