The future of OO Javascript

Source: Internet
Author: User

For about two to three months, I have been focusing on oojs (Object Oriented JavaScript.

In future projects, due to Ajax applications, more and more JavaScript code will be applied. In the face of the problems caused by the surge in code, our traditional solution is oo. Javascript is not a good OO language, so we have a lot to do, that is, how to use the features of JavaScript to imitate oo behavior and implement the OO principle.

The popularity of Ajax in action is a gospel. As the first book in the Ajax field, this book has long proposed the concept of applying design patterns to Ajax applications. This prevents us from repeating many mistakes in the early days of Ajax applications. However, the design pattern requires Oo, so JavaScript requires oo.

Well-known is the appendix B of Ajax in action, which talks about the most comprehensive oojs content that can be obtained at present. Currently, this appendix has been included on Sun's developer website. You can visit it here:

 

Ajax in Action: Appendix B-JavaScript For object-oriented programmers

 

This article discusses many JavaScript oo problems. Although it does not seem perfect, the conclusion is quite clear. Due to the inherent defects of JavaScript, some typical oo behaviors cannot be implemented on the Javascript platform, and we have to rely on our human capabilities.

Typical Types of dynamic identification are supported by browsers. I found that the Javascript instanceof operator cannot be run on both the illa1.2 and 1.7 platforms. I don't know why, because Firefox does support, and IE also supports well.

The other is interface, which has a definite answer in Appendix B of Ajax in action.

Another point is the good news. In general, prototype inheritance of JavaScript is quite flexible and should be able to make up for its shortcomings in other aspects.

However, we still expect JavaScript progress. Unknown W 3c Are there any new plans or actions in ecmascript? (Ps, W recommended 3c Make ecmascript more understandable and strict. You must know how wonderful Javascript is for the development of the Ajax age !) However, even if ecmascript has a new version, it must be implemented by mainstream browser vendors.

On a preview website in css3, we can see that IE is dragging our feet again. I can no longer express our complex feelings for IE. On the one hand, it does play a very important role in the Web development field, and I am still grateful for its excellent support for XML. However, on the one hand, some of its weird actions do dislike us. For example, the setting efficiency of opacity on IE is very low. Therefore, digg.com prohibits the display of yellow fading effects in IE. This also directly led me to abolish the yellow fading technology that we have implemented in the project and looks perfect in Firefox. PS. There is also a problem under Mozilla. I'm dizzy!

 

In any case, the problem we face is that JavaScript code has indeed increased, making it difficult to manage. Traditionally, there are only two ways to solve such problems, either by using a better method wheel, such as Oo, or by improving the tool capabilities. I am greedy. I plan to use both of them. Therefore, the path to oojs is fixed.

I am now like a weak little girl who falls into the hands of the bad guys. How powerful and powerful the powerful Spider-Man is expected to bring me away from the bitter sea. PS, I prefer the flash Wade. : P

Interestingly, I just saw a new book, friendsofed. Object. oriented. ActionScript. For. flash.8.feb. 2006. You know, now it's even time to connect to ActionScript, which shows the trend of world convergence. Fortunately, actionscript has been in the hands of a vendor, so it can develop rapidly. The problem is that the Javascript world is too messy. Where is the future of JavaScript?

I really don't want to see how everyone imitates some great things through various tips under a malformed framework. Just as we are using JavaScript private variables to simulate private methods and attributes. As mentioned in the C ++ programming language special 3rd edition, C ++ is specially designed to express the object-oriented concept, instead, we use the various features of C ++ to imitate object-oriented. But what else can we do?

Eric (co-author of Ajax in action) posted an article on his blog titled I am interviewed on sun.com, talking about Sun's recent attention to Ajax and JavaScript. Sun recently launched the Javascript Resource Center and Ajax Developer resource center to serve its developers.

It is worth noting Sun's interview with Eric, chatting with Eric pascarello. I have read Eric's book and asked him some questions. I personally think Eric has a deep skill and his article deserves attention.

PS, Eric also talked about his plan for his next book on his blog and looked forward to ing...

 

Coofucoo Zhang

Sunday, May 21,200 6

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.