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 trialKaeleb Rocha
Courses Plus Student 4,661 PointsNot finding any use for this type of programming.
What's the point of doing it this way? I can just slam this problem with a function, It wouldn't be as confusing, It wouldn't be this crazy to look at. I'm just not seeing the point of learning all of this new and confusing syntax. That much code for such a little effect seems like a waste of time and more convoluted then just using variables and functions.
Side note: I'm frustrated lol.
Kaeleb Rocha
Courses Plus Student 4,661 PointsIt's building the quiz challenge using object oriented coding. They have constructor functions, prototypes, object literals, But in my opinion it makes more sense to just build this code with a few variables, an array, and a function or 2. When he goes through his solution it's a lot of lines of code for no other reason then building it with objects.
Phillip Kerman
Courses Plus Student 285 PointsI took a look at the Object Oriented in JS material and got to the quiz--yes, I think it's fair to say some of the solutions were purposely exploring various features like storing methods in an object's prototype, and breaking things up into separate files. I think you can make an argument for each solution--it wasn't just to make it more complicated. Perhaps you wouldn't take full advantage of some of the groundwork until the project grows to much more complex. But notice how the app.js file simply used the API designed in his other quizUI class.
If you can build the same thing with just variables and functions then that's cool. You might want to challenge yourself to do so. I will say that sometimes trying to do the minimum possible can come back and bite you later when the app grows. If you list as a requirement for the code "needs to be sustainable as complexity increases or the project changes" then often that means a more complex foundation. There's always an easier way to solve something--perhaps even more elegant. I could definitely make an argument against OOP in general but that doesn't really help when you're trying to learn the benefits of OOP.
Anyway, it's definitely a difficult balance to solve--that is, between over engineering, simplicity, and making it solve the requirements at hand.
Kaeleb Rocha
Courses Plus Student 4,661 PointsI really appreciate your response, It gave me a different perspective on OOP. In my perception I was thinking I had to throw everything I was learning to implement this new syntax and now I see it's more of a mix, Use when necessary.
1 Answer
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsI would guess the reason he is using OOP for this fairly simple project is because it might help some people to understand the principles when it's not too complitcated :-)
Kaeleb Rocha
Courses Plus Student 4,661 PointsThe code felt unrealistic and hard to relate to. I was having a hard time with the way he was implementing it. I thought that I would of had to start coding similarly from this course on. So I was asking myself "what was the point of all the other courses if this is the correct way to code? Why not just work with objects immediately after the objects course so I don't waste time improperly structuring my code ".
Phillip Kerman
Courses Plus Student 285 PointsPhillip Kerman
Courses Plus Student 285 PointsIs there a specific example/exercise to which you're referring? I'd be glad to take a stab at justifying (or agreeing with you) if you point me to what you're referencing.