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 Object-Oriented JavaScript (2015) Prototypal Inheritance Updating the Song Object

James Barrett
James Barrett
13,253 Points

Cannot understand what is going on at all...Guidance?

OOP in JavaScript has been the bane of my life recently... I'm not sure if it's the syntax that's incredibly strange, Andrew's way of teaching or my general inability to understand what the heck is going on. Anyhow, I was wondering if there are any other good resources to understanding prototype inheritance.

And lastly, why should I ccontinue with OOP in JavaScript? I feel like there are other areas which I should be exploring such as Node, frameworks and everything else that Treehouse has to offer with JavaScript!

P.S Can I continue to the quiz application task at the end of this course without completing the inheritance section in this ourse?

Thanks, James.

8 Answers

Victor Engström
Victor Engström
6,226 Points

Andrew's teaching style is killing me slowly..

amirsoleimanpour
amirsoleimanpour
17,158 Points

Javascript is not an easy scripting language to learn but Andrew's style of teaching certainly doesn't help it at all!

Steven Ventimiglia
Steven Ventimiglia
27,371 Points

Andrew is great at what he does, but it seems to be explained to us as if we were him. The courses aren't paced well like others, and it always seems like a race to the finish without explaining how to run. There is no "review" of certain fundamentals that certainly need to be addressed so students can make the connection.

Jeremy Castanza
Jeremy Castanza
12,081 Points

James, I'm still trying to absorb some of this myself, so I can empathize.

My take on the OOP in JS is that they're trying to set a foundation. Ultimately, objects are an important data type (building block) that are common to many other programming languages. The other takeaway that I'm getting with this section is that they're trying to teach best practices without coming out and telling the students that.

I started my development career with WordPress and I see a lot of overlap in some areas. In WordPress, they use templates which allow you to be DRY. In other words, you can call a single header or footer files across 100's of web pages rather than repeating yourself and updating 100's of web pages when you want to make a single change. In essence, you can make that change once and 100's of web pages benefit. This is similar in a lot of respects.

Essentially, what they're tying to do is show you how to be more modular in how you programming. Ultimately, these techniques lead to faster programs since there's a "DRY" component throughout. It also allows the code to be more maintainable. Unfortunately for someone just starting out, it's pretty confusing since the person is still trying to wrap their mind around programming. Most students don't really care how maintainable their code works when they first start out. They'd rather have a program with 500 lines of code that they understand rather than a 30 line program that they don't understand.

My best advice is just trust the process. Even if it doesn't make sense now, you'll appreciate the method to the madness as you progress in your career. Skipping ahead and cutting corners often just lead you to coming back to foundation concepts like this and helps you to answer future why's and how's in programming.

James Barrett
James Barrett
13,253 Points

Hi thanks for the response. I totally agree with what you are saying. Perhaps 5 months down the line I will return to this and maybe appreciate more what Andrew is trying to teach. Since the posting of the question however, I have been focusing on just creating dynamic pages with Vanilla JS. I think when I begin to learn frameworks such as React, this will be a good starting point. :)

OOP syntax in Javascript is not nearly as easy for me to grok as it is in other languages such as Python.

I don't think it's Andrew's style of teaching as much as it is the Javascript syntax.

The simplest way I can explain this is as follows: Andrew created a new constructor (or blueprint) called Media with some properties - duration, title, isPlaying etc. Think of Song as a type of Media object which inherits its properties (duration, title isPlaying). In other languages, it would be the equivalent of a sub class or child class that inherits from Media.

Song has its own unique property, called "artist", which does not exist in the Media object.

Next Andrew uses the call() method to chain constructors for an object. You are in effect, passing it the song object https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call

Finally, Andrew uses the Object.prototype property to create the relationship between Media (base/parent class) and Song (its sub class) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype

It's not Andrew's way of teaching guys, it is what he is teaching. It is a bit hard to grasp but once you do, it becomes mmm should I say easy??? This is my third time watching this series and only now does it make sense. IF this is the first time you are watching this, I recommend you watch it at least a couple more times and not just watch it but really understand what he is trying to achieve with the code.

Michael Lauridsen
Michael Lauridsen
10,321 Points

If you have to watch a course three times, I'll have to say it's most likely not the material, but the course that is bad. A great teacher can make difficult concepts bite-sized and digestible. This is seen in a lot of courses here on treehouse, except for this course.

Michal Janek
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Michal Janek
Front End Web Development Techdegree Graduate 30,654 Points

Rewatching the videos is actually quite normal thing to do. Even if teacher is a good one if the concept is more complex rewatching will only help to solidify the ideas which you may have missed. If after watching once you understood EVERYTHING Andrew did and are able to fully replicate it then my congratulations. Just because it is paid service does not mean it will do your job though. Also people are different. I did not need to rewatch this section. We think differently and learn in different ways. I had to rewatch CSS layouts. And Guil with Nick are both good teachers.

alan twix
alan twix
608 Points

I don't think it's anything to do with his teaching style. Andrew is always very clear. It's the content. This is intermediate level and it's bound to be tougher than the earlier Javascript courses. OOP isn't always an easy concept to grasp. It takes a bit of time. Stick with it.

Hi James,

The Mozilla documentation may be the single best resource for learning JS outside of actual courses like these.

In terms of "why OOP in JS", that's a long and opinionated discussion, best extolled by someone who's already written a book which is also a really great learning resource for JS, although not as formally structured (or complete) as the Mozilla documentation.

To answer your last question, you can skip whatever material you want, or stop taking this specific course altogether and move on to another one if you'd prefer. If you want to have the course marked as 'completed', however, you'll need to pass all quizzes and code challenges in it.

Hope that helps!

udemy instructer is better than this....