DEV Community

Discussion on: What was the hardest concept for you to grasp when learning Object-Oriented Programming?

Collapse
 
ratrateroo profile image
ratrateroo

If i understand it right if you apply oop, there are oop best practices or design patterns. Am i correct?

Collapse
 
erikwhiting88 profile image
Erik

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.

Collapse
 
ratrateroo profile image
ratrateroo

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?

Thread Thread
 
erikwhiting88 profile image
Erik

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.

Thread Thread
 
ratrateroo profile image
ratrateroo

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.😃

Thread Thread
 
erikwhiting88 profile image
Erik

You're welcome, feel free to ask any questions, I'm here to help!