Object based or object oriented?
Object-oriented technology is one of the most important technologies in modern software development. The benefits of object-oriented are beyond doubt that mainstream languages like Java and C + + are now object-oriented. Now the object-oriented theory is more used to describe the Java or C + +, the root cause is that these languages are traditional object-oriented language, with object-oriented theory of all the characteristics specified: class, encapsulation, inheritance, polymorphism and so on.
In contrast, some dynamic languages such as javasript are less object-oriented-at least, there is no class name keyword in JavaScript. However, in JavaScript there is not a concept of a class. So some people say that JavaScript is an object-based language, not an object-oriented language.
Object-oriented language has three characteristics: encapsulation, inheritance and polymorphism, the three are indispensable; object-based languages are usually just objects, they implement encapsulation and do not provide the latter two features. Indeed, syntactically, JavaScript does not have a specific syntax or implement inheritance and polymorphism at the language level. However, this does not prevent us from using these features. This is because JavaScript is a flexible language, and it is quite flexible enough that none of these things are provided, or, more precisely, things that are not clearly indicated, can be implemented and used! So, can you say that JavaScript is object-based rather than object-oriented?
Object-oriented is also a thought, any language, including C language, can also use object-oriented thinking to solve the problems of real life. Is it object based or object-oriented, these concepts allow the computer philosophers to argue-and believe their arguments will end up the same as the one with the chicken or the egg first-all we have to do is use the mechanism provided by the language to solve our problems.
Why do you have JavaScript-oriented object-oriented programming?
The question is serious-it depends on the size of your problem and the scope of your application. Just like Java EE and php: What PHP can achieve, Java EE can achieve, then why do you have PHP? Because Java EE is too complex, for some simple system, there is no need to use it, that is, the so-called "kill the chicken how to use a sledgehammer."
JavaScript is primarily used in web development. In the traditional Web development model, JavaScript plays a role in embellishment, with only a limited number of functions, such as form validation. Therefore, JavaScript is used as a procedural language, it is difficult to complete complex functions. Today, Ajax is a big Web2.0, and many complex scripts are part of it. Using JavaScript object-oriented programming style in AJAX applications can make logic clearer and more conducive to problem solving.
If you want to use JavaScript to write a library, such as ExtJS or Yui, it is difficult to imagine your class library does not use object-oriented programming style-otherwise, whether it is to you or the user's intelligence will be an unprecedented test! Perhaps, since object-oriented ideas have been proposed, it is difficult to have class libraries do not use object-oriented approach, even if the C language library such as GTK +, but also in C language will be the object of the idea of a seamless performance. Object-oriented thinking plays an irreplaceable role in the compilation and use of large programs.
This series of articles will attempt to explain JavaScript's object-oriented programming to the reader. Although JavaScript has many browser-related concepts, such as document and built-in objects, this series will not address these issues and will assume that the reader already has JavaScript based grammar knowledge. This article series does not start from scratch on JavaScript syntax, just look at JavaScript from a purely object-oriented perspective, and perhaps you'll see a tutorial: object-oriented Programming--javascript language description. This is the purpose of this series of articles.
Source: http://devbean.blog.51cto.com/448512/163556