iDatamining.org

Saturday, May 28, 2011

ExtJS 4 introduces a new feature about dynamical class loading. It is not recommended in a product environment. However, it will be very useful when you want to debug your application. Especially, it is extremely helpful when you have to debug into source code of ExtJS 4 as it is still buggy now. Here is a template that I use in my project.

First of all, in HTML HEADER, I include ExtJS file ext-dev.js instead of ext-all-debug.js . And, ext-dev.js is the only JavaScript file I need to included there.

Singleton in Javascript is a little bit tough to be understood by Java developer because JavaScript does not use "class" to pursue OOP capability. Instead, it uses prototype to implement object inheriting.So, JavaScript has no "class". It only has Object. Each function is an Object in the memory.

Therefore, if you are just developing a project by yourself only, you can certainly implement your singleton as simple as below,

var singleton = {
method1: function(){},
method2: function(){}
}

However, if we want to have a more complex singleton object, which has private variable and method, we may employee below code,

I lived in China before 1999. Since 1996, I had been working as a software R&D engineer. I worked on JavaOS, a lighweight network operating system for Network Computer. Meanwhile, I used CGI, applet, swing, activeX control, and Webshpere 1.0 to develop banking Web applications.

1999~2010. I immigrated to Singapore and worked on core Java applications, Web applications, mobile applications, and interactive TV middleware and applications. Singapore feeds me more than 10 years. I appreciate her!

2010 ~ present. I moved to USA to reunion with my family. I am currently living in great Boston area. I'd like to make more friends here. Nice to meet you :)