File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "OB or OO?" Watch "OB or OO?" New topic
Author

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
Greenhorn

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.

Cheers,
Jim
Stoyan Stefanov
author
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="http://www.thinkinginjavascript.com" target="_blank" rel="nofollow">my OOJS book</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OB or OO?
 
Similar Threads
Why the title is "Object-Oriented JavaScript"
2 different types of singleton
Object Oriented Scripting
Advantage of using Singleton over a class with static methods
Why is the book titled "Object-oriented JavaScript"?