Earthquake in Toronto

Wow, there was small earthquake in Toronto at about 1:40pm today. It lasted for about 10 seconds. I was not sure if the house I was in was shaking or was it really an earthquake. I was about to run out of the house but by then earthquake had stopped. So I turned on the tv and checked CP24. It was showing a live speech by Obama. As soon as Obama’s speech was over, CP24 breaking news talked about the earthquake. There were people calling CP24 about the earthquake and telling their experiences. It was funny. Why did these people call the news amidst an earthquake? and they had the phone number of CP24 handy too? wow..these people are resourceful, they can get you a phone number of the tv news in the middle of an earthquake.

Singleton Pattern

In Singleton Pattern, the class can only create a single instance. We want a class to have only a single instance for various reasons. Sometimes, we want use a global object to keep information about your program. This object should not have any copies. This information might be things like configuration of the program, or a master object that manages pools of resources. So when you need a resource, you ask the master object to get it for you. Now if there were many copies of this master object, you would not know whom to ask for that resource. This single object should not be allowed to have copies. Singleton Pattern forces this rule so that programmer doesn’t have to remember about not creating copies. Singleton pattern will create an instance if it doesn’t exist and will not create any new instance if an instance already exist. It will just return a reference to that single instance.
class ProgramConfiguration{
    public ProgramConfiguraiton(){
        //default constructor code
    }
}
[Read more…]

Factory method design pattern

OpenOffice.org development heavily uses the Factory method design pattern. Design patterns are conventional templates that describes how to solve common software problems. Since most developers are familiar with the patterns, they can recognize a pattern in others source code. That makes working in teams easier. There are many popular design patterns. One of them is Factory method pattern. Factory method pattern is a type of creational pattern. Creational pattern pattern solves problems related to creating. Factory pattern solves two major problem generally faced by developers. [Read more…]

Reading ‘Head First Design Patterns’

It is sad that CPA in Seneca doesn’t offer any course about Software Design Patterns. I just read through chapter two about ‘Subject Observers Pattern’. Subject Observers pattern is useful when a bunch of observer objects need to be notified about change in the subject object. Observers registers themselves to get notifications from the Subject. When there is a change in any data in Subject, the subject notifies all the observers about the change. The subject object maintains a list of all the observer objects. When an observer unregisters itself, it is removed from this list. So next time, the subject notifies all the observers in its list, the unregisters are not sent any more notifications. For example, a weather tracking system that sends temperature information to all the clients every time the temperature changes.

OpenOffice development guide + example sourcecodes + api docs + more…its already installed with your OOo sdk.

wow..I just found a goldmine. :) If you have installed OOo SDK in your linux (Ubuntu/Linux Mint/…), check this folder..there are a ton of useful learning materials for OOo development. /usr/lib/openoffice/basis3.1/sdk