File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes OB or OO? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "OB or OO?" Watch "OB or OO?" New topic

OB or OO?

Liu Zhixiang
Ranch Hand

Joined: Aug 12, 2006
Posts: 32
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 ]

I Think Therefore I Am
jim cato

Joined: Jul 15, 2008
Posts: 21
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.

Stoyan Stefanov
Ranch Hand

Joined: Jul 16, 2008
Posts: 61
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.

<a href="" target="_blank" rel="nofollow">my OOJS book</a>
I agree. Here's the link:
subject: OB or OO?
It's not a secret anymore!