Write Unmaintainable Code

Every once in a while, I┬árun into this site teaching techniques for writing unmaintainable code. Of course, the hole purpose is to teach exactly the contrary (or at least that’s what I hope). Some of my favorite techniques are: use of single letter variable names, which of course makes searching almost impossible, and even less…

Happy Birthday Star Wars!

Today we celebrate 30 years since Star Wars, A New Hope was released. It is estimated that 1 billion people have seen the movie. Here are my favorite lines from the saga: Obi-wan “Use the Force, Luke”. Leia: “I love you”. Han: “I know!” Vader: “I am your father.” Luke: “No. No. That’s not true!…

Working with the Registry in VC++

Working correctly with the Windows Registry might prove a little difficult, especially for beginners. One thing one should care about for example is using the correct access rights (not just the default ones) when creating a registry key. To ease the burden of directly using the Win32 registry API, I decided to wrap them inside…

Debugging and Exception Handling

Suppose you have the following code:

When running the program, the following window is popped up: When running it in the debugger, a different window is popped up: and the debugger takes you to the line of code that threw the exception. Looking into the output window, you can see something like this: First-chance…

Performance of LINQ Queries

When I delivered the LINQ presentation at the RONUA meeting in April, I was asked how does LINQ perform on big data sets. To answer that I decided to test LINQ to XML against a 100+MB file. I decided to extract three different sets of data from this XML file: 1 set representing about 0.5MB…

Kids wanna write games

Being active in several forums for developers (CodeGuru, MSDN, Ronua) I see quite often people saying “I want to write games; what do I have to learn?” Turns out that the kind of games they want to write vary from chess to card games, from shooters to stragety games over the internet. But they can’t…