Pages

Friday 17 August 2007

Lingo - A simple word game in C#

I had 3 hours to spare, and decide to create a word game in C#. Its called Lingo, and is based on a popular TV game show of the same name. The idea is simple:

You have five chances to guess a five letter word, given two letters of the word to guess initially.

It's a simple concept, and if you like word games, would definitely appeal to you. You can get the game as well as the source files from my CodeProject article on the game. The code for the game is pretty straightforward; but if you are a beginner programmer, you can find lots to learn from it (E.g. using files as embedded resources, using a context menu, handling special keys like the arrow keys, CTRL, ALT and so on).

So do have a look, download and play Lingo! And most importantly, let me know what you think.
Enjoy.

Wednesday 1 August 2007

A reflection of generic thoughts attributed to software design

Techniques such as Reflection, Attribute-based programming and Generics (to name a few) provides the developer with a high degree of flexibility when designing today's software components and classes. Flexibility in design is a key notion that should be nurtured well, and with proper paradigms and patterns in place, should allow for adaptable constructs to be developed.

I put myself to task with a simple problem: Create a mechanism that allows importing CSV files. Each type of CSV file would represent an object in the real world. There would be a CSV file for Employees, with their details, another one for Departments, with department details and so on.
The number of CSV files, and their internal record structure can vary drastically.

You must make your class design flexible enough that with minimal effort, you are able to model different types of files and objects; you must ensure flexibility and minimum amount of work in modelling new objects and minimum re-work when modifying existing classes to suit new record structures.

I thought about this for a while, and came up with a solution involving reflection, attributes, generics and even a factory design pattern. I might have gone way over my head, but feel free to read my article at CodeProject, get a head about what's going on and tell me what you think.

After all, programming is sometimes just damn fun. :)