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…]

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

Setting up (netbeans + OOo api plugin + OOo sdk) for developing openoffice extension on Linux Mint (Ubuntu)

I downloaded the whole source codes from openoffice.org and was just about to read the guide on how to build it. Just downloading the compressed source and extracting them took about 3 hours. I could not compile the source because there were some dependency problems. I went to openoffice IRC. (http://webchat.freenode.net/ , channel: openoffice). There someone suggested me to try netbeans with OpenOffice api plugin and OpenOffice SDK). After some fiddling around, I think I finally got everything set. Now I think I can use netbeans to create OpenOffice extension (check the last pic below). There is tutorial on OpenOffice website on how to setup the netbeans to work with this. But it was missing some information specific to any Linux distribution. I am using Linux Mint which i think is basically Ubuntu. [Read more…]