Sunday, May 20, 2012

MSVS TFS Practical Ruck Guidance

Today I dug a little deeper in some white papers and guidance the ALM rangers are sharing on CodePlex.

One of the topics they cover is the use of the RUCK software development technique.

While I have seen Agile and Scrum so far, I was really interested in this one. Why?

Atm, I am working in a team where this kind of approach might be a lot better then the Agile or Scrum development techniques.
You can find more in detail here.
Because I was so impressed I shared the explanation on RUCK, which in the rugby world means "loose scrum", on YouTube to give you a quick intro on the idea behind the technique.

This video & documentation should give you an idea if this technique might be applicable in your working environment.


Saturday, May 19, 2012

Application Lifecycle Management & Team Foundation Server


Version Control & ALM
As GIS developer I use Team Foundation Server on a daily basis now. 

I used Subversion in the past, but TFS is fairly new to me. 
I've been using both products as version control only and was really interested to figure out how this tool (TFS) can be used as ALM. 
A colleague of mine suggested the use of TFS as ALM this week during a meeting.

Because of that, I decided to quickly figure out the do's and don'ts and get myself up to speed with the product and it's features.

ALM & TFS VIDEOS
Today I followed a 4 hour video course on ALM and TFS. A complete summary of the topics I tackled can be found here.

IRL Application
The video's cover a series of topics that could resolve some difficulties we face at work. I am very interested how this unfolds.

Because I don't have TFS installed at home I will have to wait till Monday to test some features I can quickly implement for personal purposes.

My First Oracle Setup


I have experience with SQL server but I am very new to Oracle Database technologies. So, it was time for me to touch the basics and take a look at some basic features Oracle holds in store for us.

1.Download
First I downloaded and installed the latest version of the oracle database available at http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Make sure you remember your password after installation!!

2.Helpfull documentation
I got myself all the necessary documentation at http://docs.oracle.com/cd/E17781_01/index.htm and started with the getting started pdf.

3.Install SQL Developer
As I am not a huge fan of using the command line to configure the database, I installed the SQL developer which allows you to do the same but in a graphical environment. I downloaded it at http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
To use the database tool, make sure you have the latest Java JDK installed on your computer. You can download it here http://www.oracle.com/technetwork/java/javase/downloads/index.html

4.Database Home Page (pdf ref 1.2)
For me this can be found at C:\oraclexe\app\oracle\product\11.2.0\server\Get_Started. Launch it and it will open in your web browser and give you access to various database administration operations.

5.Create a new User (pdf ref 2.0)
That’s why I installed the SQL developer, to make these things a lot easier then typing inside an old prompt window.
First you have to start by creating a SYSTEM connection. The username should be SYSTEM and password is the one you defined on Oracle Database installation. The name of the connection can be chosen freely.


If all went well you should see a tree view with a lot off tree nodes. Most of them are Chinese still, but there are similarities to SQL server. The treenode Other Users is the one where we define a new user and set up its privileges.



6.UNLOCK HR SAMPLE DATA
There is a HR user inside the Other Users section that should have his account unlocked. This grants you access to the tables tied to that user profile. Modify the properties of that user using the SYSTEM connection and define a new password for that HR user.
The pdf Getting Started guide continued with building an application using the wizard on the Getting Started page but I’ll skip that one. If you are into wizards, feel free to run this sample :)


7.Oracle Database XE

I read the second pfd in line found at http://docs.oracle.com/cd/E17781_01/index.htm and filtered some of the most important things I need to communicate in a descent manner from a .Net environment. At least I have a good first general impression of the Oracle Database XE now and this should be more than enough to get me started.

In the next post I’ll try to connect to the database and pull data from the HR tables using C#.

Thursday, May 10, 2012

Design Patterns - Singleton Pattern

Definition
Ensures a class has only one instance, and provides a global access to it.

Pattern examples
There are a few different approaches on how to implement the singleton pattern. I’ll show some in a C# environment.

Example 1 : “Lazy loading”.
By implementing lazy loading you insure that your class only gets instantiated when it is called upon for the first time and not earlier.

C# Code
/// <summary>
/// Singleton class. Lazy Loading. Instantiation only happens when the class is called upon for the first time.
/// Pitfall : Multithreading might result in ending up with 2 instances of the class. This implementation is not thread safe!

    /// </summary>
    public class MyLazySingleton
    {
        private static MyLazySingleton instance;

        /// <summary>
        /// Public static method that returns an instance of MyLazzySingleton
        /// </summary>
        /// <returns>Unique Instance of MyLazySingleton</returns>
        public static MyLazySingleton Instance()
        {
            //instantiate a new instance of the class if it is null
            if (instance == null)
                instance = new MyLazySingleton();
            return instance;
        }
    }

Pitfall
This piece of code is not ideal in a multithreading environment. Two instances can still be instantiated at the same time if both separate threads run over this code check:
//instantiate a new instance of the class if it is null
            if (instance == null)

Meaning, for both threads this check will be true and they will both instantiate an instance of that class, which is exactly what we want to prevent using the singleton pattern. Outside a multithreading environment this code works just fine. 

Example 2 : “Eagerly Creation”.

If the load is done at the start of the application or you are sure the class will get used for sure within your application, use eagerly creation of your singleton class. This is a thread safe implementation.

C# Code
/// <summary>
/// Singleton class. Eagerly Creation. Use this type of singleton if the load is done on startup or you are sure the singleton will be used
    /// at least once in your program. This implementation is thread safe!
    /// </summary>
    class MyEagerSingleton
    {
        /// <summary>
        /// Declare and instantiate immediatly
        /// </summary>
        private static MyLazySingleton instance = new MyLazySingleton();

        /// <summary>
        /// Public static method that returns an instance of MyEagerSingleton
        /// </summary>
        /// <returns>Unique Instance of MyEagerSingleton</returns>
        public static MyLazySingleton Instance()
        {
            return instance;
        }