Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

It has been difficult for you to get used to OOP in Javascript?

I've been struggling with JS for the last 6 months, once I think I already have it dominated, it comes something new and then I get frustrated, basically with OOP.

How long does it take for you to get used to it?

2 Answers

Hey Marcelo,

I was super confused at first, but it think it is more about sticking through the confusion. Last October is when I first started writing HTML and now I work as a front end developer at an awesome company (much thanks to treehouse). Currently I am working on an a project at work using AngularJS. What really helped me learn OOP was by spending some time looking at Ruby. Because of my time with Ruby I have come to understand OOP in JS better, however, it is good to note that JS OOP is different then classical OOP. What I have learned is that it will take years to have a language down and many more refining my code, and learning new patterns. Also, I work alongside really smart people who are always willing to show/teach me how to solve a problem programmatically. Stick in there, ask TONS of specific questions, build random things such as a todo list or tab navigation in plain old JS using OOP principles, and ask more questions. That is how I started to really learn a lot. If there is anything I can help you with in particular, let me know.

Matt

Jérôme Van Overbeke
Jérôme Van Overbeke
6,639 Points

Hi Marcelo Retana,

I very much understand you, the feeling of getting overwhelmed is very frustrating often leads to the will to stop... but stick with it :). Learning something by your own is often like this and thankfully, at the end, is worth the time and frustration. You are absolutely right when you say that when you have it dominated another thing comes along and confuses your knowledge but this is a good thing since you keep growing in your knowledge. Just don't be discouraged.

In my experience and as Matthew Ludwigs said it very well, the solution to get used to the OOP is to program, program and keep programming until it all comes together. The more time you will invest in this skill the faster it will come to you. Learning to program is not different than learning to play an instrument, it require hours and hours of beating on your craft.

On a personal note, I have never been particularly receptive to the "robot" or "machine" example when learning OOP. I have found to be really helpful for me to see the OOP as a big city (PROGRAM) where every person living in it (OBJECTS) have specific sets of skills (METHODS), abilities (FUNCTIONS) and characteristics (ATTRIBUTES) such as the hair color,... that either are available for everyone to see and use (PUBLIC) or personal and hidden (PRIVATE) such as a caring attitude for example. They can inherit skills and abilities from their parents or due to their "social classes" (PROTOTYPE).

This is just a quick explanation of my vision of OOP and I hope it could help you. If you have any specific questions I would gladly help you anytime you need because the struggle with the OOP is the battle of every programmer. OOP is the reason why javascript is a bit difficult to grasp but so powerful and fun to play with when you get used to it.

Jérôme