• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OB or OO?

 
Liu Zhixiang
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always consider that, Javascript is not an Object-Oriented Language but an Object-Based language!
In general,we simply copy property from one to another to implement 'extend'.You see ,I even do not know that is there any advantage as putting the polymorphism in Javascript!But these are the core of Object-Oriented Program Language.
So do I really need Object-Oriented JavaScript?


As we can create a object like '{}',is there need using just like following code to implementing a Singleton Mode all the same?




...

...

So I'm interested in what you will tell me in your book?
[ August 26, 2008: Message edited by: Ulf Dittmer ]
 
jim cato
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say that the 'core' of object oriented languages is the ability to represent concepts as objects, thus encapsulating data and functionality into a single logic place.

This single concept is so useful that I suggest if it is available it should be used if only to achieve modular code.

Cheers,
Jim
 
Stoyan Stefanov
author
Ranch Hand
Posts: 85
5
PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know which label is more appropriate "object-based" or "object-oriented". We can also call JS "prototype-based", "functional", "class-less" as opposed to "classical" (one that has classes). One can also argue that Java is should be filed as "class-based". At the end, the core is all about objects, right, no matter how we classify the language.

You're right that there are differences in how you can approach a problem in JavaScript as compared to a class-based language. Singleton could really be nothing more than:

Inheritance could easily be accomplished by just copying properties. Since inheritance is all about code reuse, this is a valid way to do it, although not the only one.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic