Tagged: Design

Design Patterns : Singleton

A Singleton, in software engineering, is a design pattern that is used when you only want/need to allow one instance of a class. This is specifically useful when the class instantiation of the said class is resource expensive (e.g. database connection, graphics driver, network resource and file streams…).

Below is a UML describing the implementation details of a Singleton.

designpatternsworkbook_singleton_diagram

Here is an example of a Thread-safe Singleton implemented in C#. In this example, we are trying to simulate a DbConnection object. The DbConnection object has a private constructor that blocks users of this class from ‘new-ing’ this object. Instead, the DbConnection object has a property called Instance that allows users creates a copy of DbConnection.

designpatternsworkbook_singleton_classdiagram

Running the above code will have this output:

designpatternsworkbook_singleton_outputresult

 

Mobile Application User Interface Patterns

Mobile UI Patterns
Mobile Application User Interface Patterns

A coworker showed me this website today and I was amazed with collection of mobile application user interfaces this website has collected. The site contains screenshots of some of the popular mobile apps as well as some applications that are not as popular but with great interface designs.

Bookmark and checkout http://mobile-patterns.com/. This site may come handy when you need some mobile design ideas and motivations. 😉

How To: Create a BulletList in Silverlight

I was working on a prototype application today when I needed to use a BulletList. At first I thought it existed on the toolkit controls but to my surprise it wasn’t so I ended up creating an ItemsControl template that mimics how a BulletList would behave. I wanted to post it here to show you how I did it:

 

As allways you can download a sample project here: KeithRull.SLBulletList

Fun! Now time to get back to my code zen.

Cheers!