’Almost real’ functor objects in C#

October 27th, 2007

In these days of delegates, anonymous methods and lambda expressions, I’ve found it necessary to talk about good old functor objects. A functor is an object, that in some fashion you can treat as a function. Put another way, a functor is an object that you can call. Read the rest of this entry »

Lazy programming…

October 13th, 2007

I’ve been working alot with web services lately, querying for information and recordsets, applying business logics and then finally displaying it all on a web page. A problem that I need to deal with (it feels like) all the time is empty responses from the service layer.

Sometime the response is null, sometimes not. Sometimes inner collections of a response are empty, null… anyway, it end up with alot of theese:

if (products != null)
{
    foreach (Product product in products)
    {
        // do something with product
    }
}

Doing these if-nulls over and over again made me realize that I needed an NeverNullEnum wrapper, Read the rest of this entry »

Multi-threading the wrong way.

October 12th, 2007

Some time back I had an experience down at a local supermarket, a strange experience that reminded me of a neglected topic in software development. The topic of efficient multi-threading.

Everybody knows multi-threading as a difficult thing. Multi-threaded applications are inherently difficult to develop, debug and maintain and has potentially evil pitfalls in form of race-conditions and deadlocks and what not. You need your thoughts clear and your tongue straight and remember to put locks, monitors and synchronization objects all over your code… but in the end it will make your application run at leaping speeds while utilizing the smallest of transistors in your top-notch multi-core CPU. Read the rest of this entry »

Powered by WordPress. Entries (RSS) and Comments (RSS).