This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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
posted
0
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
posted
0
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.