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 »

Monitor your collection

July 9th, 2007

There are times when you want your class to expose some kind of collection. Maybe you got a Server class and want to world to access it connections, or you got a Family class and want to provide access to the collection of family members. Sometimes that is easy - just to return a reference to the collection from a function or property. Other times it’s not that easy.
Read the rest of this entry »

VB.NET Chapter #3 - IsSomething?

June 6th, 2007

I once worked together with this developer that seems to enjoy (or had a rather bad habbit of) turning every logic expression into its negative complement. That is, instead of properties (or fields) named Enabled or Visible, his properties would be named Disabled or Hidden. It made every expression look like:

If Not Disabled And Not Hidden Then       

    'enabled and visible       

End If

Read the rest of this entry »

Worst Professional Blunders…

May 29th, 2007

Here’s a litt story of how things shouldn’t be (first posted at Codeguru).

I was once asked to fix this totally non-critical feature in a very critical application. The argument was “we really don’t need it, but since it’s documented you may as well make it work”.
Read the rest of this entry »

in·con·sis·tent III

May 17th, 2007

This one is just too good to go unnoticed.

http://redsolo.blogspot.com/2007/01/continued-inconsistencies-in-net.html

VB.NET Chapter #2 - What IIF?

May 16th, 2007

Don’t let them trick you! MSDNs description of the IIF function is not correct. Read the rest of this entry »

VB.NET Chapter #1 - The Babysitter from Hell

May 3rd, 2007

[I'm no VB enthusiast, so pardon me if this post is a bit biased.]

When I started out programming, a long time ago, the motivation was utter control. I wanted to master the computer, see how far I could get and how much I could get a away with. It was all about circumventing any obstacle in my path. I’ve done a lot of bad things. Some on purpose, some by pure ignorance, some on pure luck. And usually I learn something from it (moral, ugh). Read the rest of this entry »

Obfuscating Javascript on the fly

March 28th, 2007

I was working on this extremly bleeding edge .NET application with some hightech (stolen) javascript code, when I figured I needed a way to obfuscate the client side scripts. I searched the web twice, but all I came up with was a couple of advanced desktop applications that could do the trick… but that was not what I wanted… Read the rest of this entry »

Creating a general delegate using Generics

February 27th, 2007

Yariv Hammer has a great post on how to generalize delegates by using Generics. And, since he kindly mentions me in that post I just had to put up a link.

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