Is it object-based or object-oriented?Object-oriented technology is one of the important technologies in modern software development. There is no doubt about the benefits of object-oriented development. Currently, mainstream languages such as Java and C ++ are object-oriented. Currently, object-oriented theories are mostly described using Java or C ++. The root cause is that these languages are traditional object-oriented languages, it has all the features specified by object-oriented theory: Class, encapsulation, inheritance, polymorphism, and so on. In comparison, some dynamic languages such as JavaSript are not so object-oriented-at least, there is no class keyword in JavaScript. However, JavaScript does not have a class concept. Some people say that JavaScript is an object-based language, not an object-oriented language. Object-oriented languages have three features: encapsulation, inheritance, and polymorphism. Object-based languages generally only use objects, and they implement encapsulation, the last two features are not provided. Indeed, in terms of syntax, 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 that is quite flexible, so that these are not provided, and more specifically, they are not explicitly indicated, can be implemented and used! So, can you still say that JavaScript is based on objects rather than object-oriented? Object-oriented is also an idea. Any language, including the C language, can also use the object-oriented idea to solve various problems in real life. Is it object-based or object-oriented, let the computer philosophers argue over these concepts. I believe that their arguments will eventually be the same as the question of having a chicken or an egg. What we have to do, we need to use the mechanism provided by this language to solve our problems.
Why is JavaScript object-oriented programming required?This issue is serious-it depends on the scale of your issue and the scope of its application. Just like Java EE and PHP: everything that PHP can implement can be implemented by Java ee. Why does it need PHP? Javaee is too complicated. For some simple systems, there is no need to use it, that is, the so-called "cool-down tool ". Javascript is mainly used in Web development. In the traditional web development mode, JavaScript serves as an embellishment to complete only a limited number of functions, such as form verification. Therefore, JavaScript is often used as a procedural language, making it difficult to complete complex functions. In today's web era, Ajax is widely used, and many complicated scripts become necessary components. Using JavaScript object-oriented programming style in Ajax applications can make the logic clearer and help solve the problem. If you want to write a library in Javascript, such as extjs or Yui, it is hard to imagine that your class library does not use the object-oriented programming style-otherwise, whether it is for you or for the user's intelligence will be an unprecedented test! Perhaps, since the introduction of Object-oriented thinking, it is difficult to implement class libraries without the use of object-oriented methods. Even C language libraries such as GTK +, it is also a seamless representation of object-oriented ideas in C language. Object-oriented thinking plays an irreplaceable role in writing and using large programs. This series of articles will attempt to explain to readers the Javascript object-oriented programming. Although JavaScript has many browser-related concepts, such as document and other built-in objects, this series does not address these issues and assumes that the reader already has basic JavaScript syntax knowledge. This series of articles will not cover the Javascript syntax from the beginning, just look at JavaScript from a purely object-oriented perspective, maybe, you will see a tutorial: Object-oriented programming-JavaScript language description. This is the purpose of this series of articles.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service