OOP in JavaScript

+3 Tsin Fung Johnny Lam · December 1, 2014
Hey guys!
I am taught the Object-Orientated programming with JavaScript in my campus.
My lecturer writes his own notes for us to learn it. He said he just discover it (OOP in JavaScript) in last 
year. He seems like really excited about this.

While I and my classmate also think the OO approach in JavaScript is very weird, that seems like
just force it to act like OO. For example, you need to use method to imitate a constructor.
The purpose of OO should be used to make everything be more tidy and clear, but OO in 
JavaScript seems like more awkward and chaotic.

Just want to know what are you guys' thought on it?

Post a Reply

Replies

Oldest  Newest  Rating
+1 Jason Amador · December 11, 2014
You really just have to change the way that you look at things.  Since you can treat anything as an object in js, you just write a "constructor" to create new objects of a certain type.  It's very powerful and flexible.  But it does take getting used to.  
+1 Landon Luman · December 3, 2014
OOP in Javascript would make it look a lot more like, well, Java - Scripts. 

I can see where JSON will be a bit more common! And we all love JSON :P

But yeah, it sounds like a neat concept!
+1 Brendon McBain · December 4, 2014
Yeah, I agree with this. I found it really strange having to deal with functions inside of functions, it really screwed my brain! Although it is away from the norm, I think it does have some advantages because of the accessibility and convenience that it provides. I haven't used this language all that much, I have used similar languages with the conventional OOP style. These are just some thoughts that I recently had when using JavaScript for a current project.
0 Predrag Kostic · December 7, 2014
Same, I agree with Brendon, it can screw with your brain. But that's what it is. I wish it was easier, more people would get into coding for web :/
  • 1

Javascript

107,068 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators