I would say about 99% of developers use OOP in their day-to-day programming and perhaps even a higher percentage than that learn OOP at the very le...
For further actions, you may consider blocking this person and/or reporting abuse
I think it's the interfaces for me. I thought initially that interfaces where the same as classes and it took me a while to understand their uses. Besides that, the 4 pillars was a struggle too in the beginning. The easiest concept for me was objects😅.
the 4 pillars? I'm not familiar with this
Yes, Abstraction, Encapsulation, Inheritance and Polymorphism.
Ooh those, thank you!
You're welcome!
Oh yes! Inheritance was alright. But Abstraction, Encapsulation, and Polymorphism!
It took a really long time for me to understand what Abstraction and Encapsulation mean and how they're different. And a lot more, to understand what Polymorphism is.
Also, it always surprises me how many people have confusion with interfaces.
I know a lot of people who don't have much experience with OOP and they think that interface is something that allows multiple-inheritance in Java. That's what we're taught at colleges where I live.
Was it the same with you?
Btw I wrote an article on interfaces. I'd love to hear your thoughts on it.
Do you really understand interfaces?
Gaurang ・ Mar 15 '20 ・ 8 min read
For me, recursion was the issue when trying to do functional programming. I generally tried to eliminate it in my procedural / OOP code and it was just breaking my brain to get it right in functional where it's practically required.
It took me 10 years and 3 to 4 exploded class hierarchies to realize that inheritance is probably not what you need to promote code reuse.
I wonder why they keep teaching that. Code reuse => functions (or object aggregation, at best!)
Honestly for me, it was learning that a lot of projects don't do a great job with OOP. I think a lot of times we embark on projects without being able to represent the domain with enough knowledge to create an accurate representation of systems, resulting in fun code you might have seeing before like AbstractLoggerFactoryFactory :D
While learning Java, I did struggle to differentiate between inheritance and polymorphism.
If i understand it right if you apply oop, there are oop best practices or design patterns. Am i correct?
Yes, there are best practices for OOP, but there are best practices for lots of things.
Design patterns are not necessarily OOP-specific as you can have functional programming design patterns too (like the Failure Monad for example).
In an OOP context, a design pattern is a specific relationship between one or more classes to get some kind of desired behavior; you don't technically need to know design patterns to know OOP.
In real world scenario in oop as of now do often use common design patterns like singleton and other stuff or for complex problems you just do freestyle?
a little bit of both. Sometimes, problems are so common that we just know we're going to need a singleton (or factory, or observer, etc), so that's what we build.
Other times, problems aren't so obvious and the solution we come up with starts to look like a pattern sometimes.
You don't need to worry too much about design patterns when you're first learning OOP. Get more comfortable with OOP concepts like polymorphism and inheritance, then learn about writing SOLID code. After that, learning design patterns will be really easy.
Thank you for sharing your knowledge im starting to see a bigger picture now. I studied oop with java few years ago and that knowledge helped me a lot when i started javascript. From then on i always think in oop.😃
You're welcome, feel free to ask any questions, I'm here to help!
stay away from over engineered.
I struggle with this every day of my career lol
99%?
I doubt embedded programmers use OOP
Incorrect. Embedded devices that require higher processing power use embedded Linux and C++. A basic example is abstraction of HW layers when retrieving data.
cool, I had no idea
Coming from a mostly assembler background at the time I found it very hard to use, just because I couldn't see exactly what it was doing.
If anyone is struggling to wrap their head around OO programming, I recommend the first edition of Java In A Nutshell. It is long out of print, and the Java content is very out of date - to the extent that some of it is just plain wrong now - but the introductory chapters on what OO programming is are excellent. Later editions don't do anything like as good a job of this.
Coupling and cohesion. We use those concepts everyday in the real world but initially fail to use in OOP. In fact it's the same in every paradigm.
Abstract class.
for me, it was trying to understand the difference between Encapsulation and abstraction. I really get confused between these two concepts.
is it that you get confused on which is which, or are both concepts difficult to understand on their own?