Using Singletons Safely

9. December 2008

The singleton is probably the best known of the GoF Design Patterns, it’s also the most controversial. I try avoid using singletons in my code when I can but since the singleton is a very simple but powerful pattern I sometimes sin against the decoupling gods and use one or two of them. Lots of stuff has been written about creating singletons. In this post I want to show you how properly use a singleton and contain most of the damage singletons do.

This post was inspired by a Twitter discussion I had with @LaTtEX who blogs here

More...

Why software engineering is NOT like structural engineering

4. December 2008

While cycling home from work today I was listening to the Deep Fried Bytes episode with Rico Mariani. I should have been warned by his introduction; “He has an analogy for everything”. But since he seems to be a smart person the good old “Software engineering is just like structural engineering” caught me by surprise. I thought we ditched that one together with the waterfall process.

More...

XP Embedded Shell.Run problem solved, here's how

2. December 2008

I had a problem on XP Embedded running a vb-script file with wscript. Creating a shell object and calling the run method gave me a permission denied error (error number '800a0046') even when I was running as administrator. It didn't matter what I was trying to run. Even notepad.exe gave me this error. I've seen more people post questions about similar errors around the internet but I never found a usable answer so I thought I'd share the solution I worked out myself.

More...

I am a scientist!

2. December 2008

If you're having trouble reading my blogposts it's not your fault. It seems I'm so abstact and theoretical in my communication that I have trouble communicating my visions to other people.

More...

When to use static methods

14. November 2008

I started using Resharper again after some time. And one thing that bugs me is that it always warns me that functions can be made static. I've kinda stopped using static methods. Static methods arent injectable, static methods make code using them less modular and less testable and static methods are the devils own handywork if you want to believe some people. On the other hand they make your code simpler by not requiring an object instance to be called. This got me thinking. Do I want to use statics or just ban them completely? And if not when is it oke to use them?

More...

Sequence diagrams with websequencediagrams.com

27. October 2008

Someone (I forgot who, that's why I'll just post the answer here) asked me how I got the sequence diagrams in my last post

http://www.websequencediagrams.com/

This is a great tool, especially for programmers. I like the way you just type some simple commands and out pops your diagram. You can select from some examples to learn the syntax of the language and adapt them to your own needs.

Select style "napkin" for added grunge and a general UML-as-a-sketch feel 

This is how I like my tools. Simple, quick, discoverable and nonintrusive. Great stuff! 

Using events to improve testability and reduce temporal coupling.

25. October 2008

Temporal coupling in code is usually not very obvious but can cause maintainability nightmares. Code is coupled not by direct dependencies but by depending on the state that left behind by another piece of code. Temporal coupling is not something that should be avoided but it should be expressed explicitly. Someone editing your code should be able to see clearly where dependencies lie.

Functional languages solve this problem by not having side effects. Ordering of functions is very clear if you follow the returned values. In OO languages like C# you don't always have this luxury. Side effects can make things difficult for us. In this post I want to show a different approach to solving this problemMore...

Windows XP Embedded, windows is lego.

10. October 2008

lego steentjes I haven't been programming much lately, I've been playing with Windows XP embedded instead. It's a great product that's not very well know. I'll probably be posting a lot more about this version of windows in the future so I thought I might start with describing my first impressions of it.

More...

Unit testing and PInvoking pt.3

30. September 2008

In the previous parts of this short series (that took a long time to finish) I looked at testing code that depends on pinvoke calls. I did this by wrapping the PInvoked functions in a class and then injecting that class into the depending code. I used the wrapper class to put some checks around the platform invokes to smooth some rough edges of the calls to unmanaged land. This creates a nice reusable interface around these calls but now we have the same problem we started with, testability. In this post I'll look at adding a final layer of indirection to be able to test this code.

More...

Process weirdness and how to solve it

24. September 2008

I had a weird problem today. For a piece of software I'm creating I had to start an executable and then poll it periodically to see if it was still living. If it didn't respond for a certain time my program had to kill it and start over. There's a neat class in System.Diagnostics that can do this. System.Diagnostics.Process. But I found sometimes it acts a little strange.

More...

Powered by BlogEngine.NET 1.4.5.0
Theme adapted from BlogEngine.NET standard theme by Mads Kristensen

Mendelt Siebenga

Mendelt Siebenga with coffeeMendelt Siebenga is currently working as a C# programmer. In his spare time he's been known to pick up Python, F# and even a soldering iron from time to time.