-->

The Singleton Pattern ensures a class has only one instance that provides a global point to access it. This design pattern is perfect for maintaining a set of configurations or other variables always available at run-time in your software.

public static Singleton getInstance() {
    if (uniqueInstance == null) {
       uniqueInstance = new Singleton();
    }
    return uniqueInstance;
}

In this code snippet, if you have a multithreaded application that executes the same class, some concurrency problems can occur. For instance if the two threads accesses to the condition at the same time, creates two different Singleton instances. How can you fix this problem? Newer virtual machines (like JVM 1.5) ensures this when you create the Singleton instance in a static variable outside of any method. The JVM guarantees that the instance will be created before any thread accesses the static uniqueInstance variable. The solution for this is:

public class Singleton {
    private static Singleton uniqueInstance = new Singleton ();

    private Singleton() {}

    public static Singleton getInstance () {
       return uniqueInstance;
    }
}

What is the 80/20 rule and why is it so important to entrepreneurs? Wikipedia says:

“The principle was suggested by management thinker Joseph M. Juran. It was named after the Italian economist Vilfredo Pareto, who observed that 80% of income in Italy was received by 20% of the Italian population. The assumption is that most of the results in any situation are determined by a small number of causes.”

80-20-ruleThis rule says that 80% of your outcomes come from 20% of your inputs. For instance, in your life, there are certain activities that you do (your 20%) that account for the majority (your 80%) of your happiness and outputs.

The 80/20 rule can be applied to your life and your business, where being happy and satisfied for what you do, is the most important thing. Off course that money is important, but it shouldn’t be so important compared to your happiness.

Live your life following the 80/20 rule. Follow your dream!

(more information about the 80/20 rule)