<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hello Thupten &#187; &#187; Opensource</title>
	<atom:link href="https://www.thupten.feedback/category/academic-works/opensource/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.thupten.feedback</link>
	<description>Just another developer&#039;s blog</description>
	<lastBuildDate>Sat, 09 May 2026 14:41:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.2</generator>
	<item>
		<title>Singleton Pattern</title>
		<link>https://www.thupten.feedback/2010/06/20/singleton-pattern/</link>
		<comments>https://www.thupten.feedback/2010/06/20/singleton-pattern/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 22:21:49 +0000</pubDate>
		<dc:creator><![CDATA[thupten]]></dc:creator>
				<category><![CDATA[Opensource]]></category>
		<category><![CDATA[Others]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[single object pattern]]></category>
		<category><![CDATA[singleton]]></category>
		<category><![CDATA[singleton pattern]]></category>

		<guid isPermaLink="false">http://thupten.veryusefulinfo.com/?p=83</guid>
		<description><![CDATA[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 [&#8230;]]]></description>
				<content:encoded><![CDATA[<a href="http://thupten.feedback/wp-content/uploads/2010/06/singleton.png"><img class="alignright size-full wp-image-86" title="singleton" src="http://thupten.feedback/wp-content/uploads/2010/06/singleton.png" alt="" width="200" height="240" /></a>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&#8217;t have to remember about not creating copies. Singleton pattern will create an instance if it doesn&#8217;t exist and will not create any new instance if an instance already exist. It will just return a reference to that single instance.
<pre name="code" class="java">
class ProgramConfiguration{
    public ProgramConfiguraiton(){
        //default constructor code
    }
}</pre>
<span id="more-83"></span>
A new instance of a class is created by the constructor. Most of the time, we have a public constructor, which is called to create a new instance. Since we want to prohibit multiple instance, we have to restrict access to the constructor. This is done by making the constructor private.
<pre name="code" class="java">
class ProgramConfiguration{
    private ProgramConfiguration(){
        //default private constructor code
    }
}</pre>
then we create a static public method that will make sure that only one instance lives in the whole program.
<pre name="code" class="java">
class ProgramConfiguration{
    private static ProgramConfiguration _configObject;
    private ProgramConfiguration(){
        //default private constructor code
    }
    public getInstance(){
        /*
        if an instance exist return that instance otherwise
        call the constructor to create an instance and return it.
        */
        if(_configObject == null){
            _configObject = ProgramConfiguration();
        }
    return _configObject;
    }
}</pre>
So anytime you want to get that single object, you call the getInstance() method.
<pre name="code" class="java">
public static void main(String[] args){
    /*
    no access to default constructor. so if you did
    ProgramConfiguration pc = new ProgramConfiguration();
    you will get compilation error.
    */
    ProgramConfiguration pc = ProgramConfiguration.getInstance();
    ProgramConfiguration newpc = ProgramConfiguration.getInstance();
    /*
    in the above code pc and newpc both point to the same static object. when
    getinstance() is called for the second time, it finds that _configObject is not null
    anymore, so it doesn't call the constructor to create any new instance.
    */
}</pre>]]></content:encoded>
			<wfw:commentRss>https://www.thupten.feedback/2010/06/20/singleton-pattern/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Factory method design pattern</title>
		<link>https://www.thupten.feedback/2010/06/09/factory-method-design-pattern/</link>
		<comments>https://www.thupten.feedback/2010/06/09/factory-method-design-pattern/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 08:45:01 +0000</pubDate>
		<dc:creator><![CDATA[thupten]]></dc:creator>
				<category><![CDATA[OpenOffice]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[factory method design pattern]]></category>

		<guid isPermaLink="false">http://thupten.veryusefulinfo.com/?p=62</guid>
		<description><![CDATA[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 [&#8230;]]]></description>
				<content:encoded><![CDATA[<a href="http://thupten.feedback/wp-content/uploads/2010/06/Factory_1.png"><img class="size-full wp-image-74 alignright" title="Factory_1" src="http://thupten.feedback/wp-content/uploads/2010/06/Factory_1.png" alt="" width="200" height="165" /></a>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.
<span id="more-62"></span>
To reduce too many new operator usage
<ol>
	<li>When working on a large software, numerous instances of classes are created continuously at the runtime. The programmer cannot predict what the user is going to do. So at any given time, the programmer doesn&#8217;t know what object is create. For example, To create a new document, the user might click new text document or new spreadsheet document. There would several possibilities about what the user is going to do. So, a factory class is assigned to do all  these repetitive work of creating a new instance of what the user wants. By separating these repetitive object creations into a factory class, when new classes are added, only the factory class need to be updated.</li>
	<li>To create object without knowing its class name.
When using the concrete classes, the developer has to remember the class names. In factory pattern, choosing what type of object to be created is delegated to the factory class. Usually this is done by sending a parameter. Based on the parameter passed to the factory, the factory creates an instance of a certain type/class.</li>
</ol>
<a href="http://thupten.feedback/wp-content/uploads/2010/06/factorypattern.gif"><img class="alignnone size-medium wp-image-65" title="factorypattern" src="http://thupten.feedback/wp-content/uploads/2010/06/factorypattern-300x151.gif" alt="" width="300" height="151" /></a>

Here is the pseudo code.
<pre name="code" class="java">
public final class DocumentFactory {
   XDocument document;
   XDocument getDocument(String type){
      if(type.equals("text"){
         document = new TextDocument();
      }
      else if(type.equals("sheet"){
         document = new SpreadSheet();
      }
   return document;
   }
}</pre>
<pre name="code" class="java">
public interface XDocument{
   open();
}</pre>
<pre name="code" class="java">
public class TextDocument implements XDocument{
   //concrete class for Text documents
   open(){
      //method to open text document
      System.out.println("opening a text document...");
   }
}</pre>
<pre name="code" class="java">
public class SpreadSheet implements XDocument{
   //concrete class for spreadsheet documents
   open(){
      //method to open spreadsheet document
      System.out.println("opening a spreadsheet document...");
   }
}</pre>
<pre name="code" class="java">
class DocumentProgram{
   public static void main(String[] args){
   //this just created an instance of TextDocument without knowing its class name.
   XDocument doc = df.getDocument("text");
   doc.open();
   }
}</pre>]]></content:encoded>
			<wfw:commentRss>https://www.thupten.feedback/2010/06/09/factory-method-design-pattern/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenOffice development guide + example sourcecodes + api docs + more&#8230;its already installed with your OOo sdk.</title>
		<link>https://www.thupten.feedback/2010/06/01/openoffice-development-guide-examples-docs-more-its-already-installed-with-your-ooo-sdk/</link>
		<comments>https://www.thupten.feedback/2010/06/01/openoffice-development-guide-examples-docs-more-its-already-installed-with-your-ooo-sdk/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 07:40:58 +0000</pubDate>
		<dc:creator><![CDATA[thupten]]></dc:creator>
				<category><![CDATA[OpenOffice]]></category>

		<guid isPermaLink="false">http://thupten.veryusefulinfo.com/?p=47</guid>
		<description><![CDATA[wow..I just found a goldmine. If you have installed OOo SDK in your linux (Ubuntu/Linux Mint/&#8230;), check this folder..there are a ton of useful learning materials for OOo development. /usr/lib/openoffice/basis3.1/sdk]]></description>
				<content:encoded><![CDATA[wow..I just found a goldmine. <img src="https://www.thupten.feedback/wp-includes/images/smilies/simple-smile.png" alt=":)" class="wp-smiley" style="height: 1em; max-height: 1em;" />

If you have installed OOo SDK in your linux (Ubuntu/Linux Mint/&#8230;), check this folder..there are a ton of useful learning materials for OOo development.

<code>/usr/lib/openoffice/basis3.1/sdk</code>

<a href="http://thupten.feedback/wp-content/uploads/2010/06/Ooosdkfolder.png"><img class="alignnone size-full wp-image-48" title="Ooosdkfolder" src="http://thupten.feedback/wp-content/uploads/2010/06/Ooosdkfolder.png" alt="" width="585" height="391" /></a>]]></content:encoded>
			<wfw:commentRss>https://www.thupten.feedback/2010/06/01/openoffice-development-guide-examples-docs-more-its-already-installed-with-your-ooo-sdk/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting up (netbeans + OOo api plugin + OOo sdk) for developing openoffice extension on Linux Mint (Ubuntu)</title>
		<link>https://www.thupten.feedback/2010/05/17/setting-up-netbeans-oo-api-oo-sdk-for-developing-openoffice-extension-on-linux-mint-ubuntu/</link>
		<comments>https://www.thupten.feedback/2010/05/17/setting-up-netbeans-oo-api-oo-sdk-for-developing-openoffice-extension-on-linux-mint-ubuntu/#comments</comments>
		<pubDate>Mon, 17 May 2010 06:06:44 +0000</pubDate>
		<dc:creator><![CDATA[thupten]]></dc:creator>
				<category><![CDATA[OpenOffice]]></category>

		<guid isPermaLink="false">http://thupten.veryusefulinfo.com/?p=15</guid>
		<description><![CDATA[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 [&#8230;]]]></description>
				<content:encoded><![CDATA[<a href="http://thupten.feedback/wp-content/uploads/2010/05/openofficeDevelopmentWithNetbean.png"><img class="alignright size-full wp-image-76" title="openofficeDevelopmentWithNetbean" src="http://thupten.feedback/wp-content/uploads/2010/05/openofficeDevelopmentWithNetbean.png" alt="" width="200" height="153" /></a>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.
<span id="more-15"></span>

Open package manager in Linux Mint or the Synaptic package manager in Ubuntu to install the openoffice with SDK. By default, when we install OpenOffice, it doesn&#8217;t install the SDK. <span style="color: #ff0000;">(edit: openoffice.org-dev  is the program you want to install. SDK is included with it).</span>

Then, install netbeans.

Then, install the plugin from netbeans -&gt; tools -&gt; plugins.

<a href="http://thupten.feedback/wp-content/uploads/2010/05/Screenshot-11.png"><img class="alignnone size-full wp-image-25" title="Screenshot-1" src="http://thupten.feedback/wp-content/uploads/2010/05/Screenshot-11.png" alt="" width="400" /></a>

When using the plugin for the first item, it will require paths to the OpenOffice and the OpenOffice SDK directory. Once they are provided, it is ready.

<a href="http://thupten.feedback/wp-content/uploads/2010/05/Screenshot-21.png"><img title="Screenshot-2" src="http://thupten.feedback/wp-content/uploads/2010/05/Screenshot-21.png" alt="" width="400" /></a>

<a href="http://thupten.feedback/wp-content/uploads/2010/05/Screenshot-31.png"><img title="Screenshot-3" src="http://thupten.feedback/wp-content/uploads/2010/05/Screenshot-31.png" alt="" width="400" /></a>]]></content:encoded>
			<wfw:commentRss>https://www.thupten.feedback/2010/05/17/setting-up-netbeans-oo-api-oo-sdk-for-developing-openoffice-extension-on-linux-mint-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
