Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home AJAX-Design
 

Pseudoclassical Inheritance Pattern

 

The buzz about the release of Closure Library from Google still lingers as developers continue to dig deeper on how Google pulled off some of the most impressive sites online. The library has already bared a lot of things such as its impressive compiler, compatibility with various browsers and its relatively unknown inheritance pattern.


The inheritance pattern used in Closure Library is called "pseudoclassical pattern". In gist, this type of inheritance pattern is minimalist by design but highly optimized to work with various functions in an Ajax or JavaScript based application. The inheritance pattern makes use of * to denote a function, variable and parameter. The common function is practically calling the library to implement something in the client side.


Advantages of Pseudoclassical Pattern


One of the most impressive features of pseudoclassical pattern is the ability of the code to be fully optimized. Inline optimization, improvement of codes and other optimization techniques can be implemented in this pattern.


Other patterns can still be optimized the same way but what made pseudoclassical pattern different is that it's still readable after optimization. The use of * has actually helped since it has allowed developers identify which function is used.


Another advantage of the pattern is its treatment of superclass methods. Since closure library is using a unique library, some superclass methods cannot be easily implemented. In most inheritance patterns, renaming the superclass methods cannot be done because this process will change the method's functionality. This inconvenience does not happen in pseudoclassical as it preserves the features of superclass methods. Developers will still enjoy superclass methods in Closure Library.


Arguments Against Pseudoclassical Pattern


While there are those who favor pseudoclassical pattern, there are those who are adamant with the advantages provided by the application. The following are the common objections:


• Additional learning requirement on security - A more popular inheritance pattern will most likely focus on privacy more than anything else. Pseudoclassical pattern, on the other hand, focuses on ease of access more than anything else. This doesn't mean the pattern ignores security. Enhancing security in this pattern will require developers to increase private properties as well as carefully annotating the objects that should be kept private.


• Challenge to the new operator - Part of the learning process of adopting the Closure library as well as the pseudoclassical inheritance is that the "new" operator function is required when implementing the function. Calling "new" is a must so that the @constructor function will immediately implement the needed function. While this can be a debilitating drawback, there are other libraries for Ajax and JavaScript that can fix this problem. JSLint can provide an early warning function in case the "new" function does not exist.


Pseudoclassical pattern will most likely draw additional support from developers now that it has been associated with Closure library. But more than being associated with a popular library, developers can improve their application through this inheritance function because of ease of development. If you're new to this inheritance pattern, learn more about to be highly competitive in Ajax and JavaScript.



Read Next: Cross-Domain iFrame without Polling



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links