<$BlogRSDUrl$> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } }
Monday, January 12, 2004
Patterns

The following document is the first honest attempt on my part to understand patterns. I am using as reference.

Creational Patterns
  1. Singleton : One instance of a class and accessible globally
    Features :

    • Ensure unique instance by defining class final to prevent cloning.

    • May be extensible by the subclass by defining subclass final.

    • Make a method or a variable public or/and static.

    • Access to the instance by the way you provided.

    • Well control the instantiation of a class

    • To design a Singleton class, you may need to make the class final like java.Math, which is not allowed to subclass, or make a variable or method public and/or static, or make all constructors private to prevent the compiler from creating a default one.

    Examples
    One file system, one window manager, one printer spooler and etc.


This page is powered by Blogger. Isn't yours?