2010-12-11

Insourcing and responding to change

Just found a Danish job ad with an interesting, as well as promising, wording:

"
Udviklingen er for nylig blevet insourcet igen efter nogle års outsourcing [...] Formålet med insourcingen af udviklingen er at sikre hurtigst mulig reaktion i forhold til både vores danske kædekunder og vores internationale ekspansion."

The ad can be viewed here: http://goo.gl/vFHpm

2010-11-24

The only people who like to hear that their code is bad, is people who's trying to get better

"If you price yourself high, you're gonna get better clients. The same is true for information in a supply and demand situation when you're trying to help someone that doesn't wanna be helped is no good.

- I can show you how to be better.

- I don't want to be better. I want to keep sucking.

Let them keep sucking! The only people who like to hear that their code is bad, is people who's trying to get better. Those are the only people you wan't to associate with in the first place anyway.


[...] If you don't set yourself apart, you're going to work on mediocre projects. That'll screw you over. It kinda makes you stupid."

- Giles Bowkett in this.life() 1.0.4: Being Mean

2010-05-04

Coders at Work Speaking Words of Wisdom

I've finished reading Coders at Work where Peter Seibel interviews "15 of the all-time greats of programming and computer science" about the craft of programming and related topics.

It's a very interesting book, which I wholeheartedly recommend to anyone who cares about their profession as a software developer.

Below some words of wisdom from three of the interviewees:

Thompson: "My definition of fragile code is, suppose you want to add a feature — good code, there's one place where you add that feature and it fits; fragile code, you've got to touch ten places."

Siebel: "[…] people […] work long hours because we have this idea that we've got to get this product out the door and the way to do it is for everyone to work 80, 100 hours a week."

Thompson: "That generates burnout. […] external deadlines — generate stress."

Siebel: "[…] in terms of getting things done in the short term, does it work?"

Thompson: "Usually you're in a position where such a thing is continual."

Siebel: "Can you estimate how long it's going to take to write a given piece of code?"

Thompson: "[…] if you're doing it for production then usually there are other people involved and coordination — I can't estimate that."
Ken Thompson, p. 467, 478 & 479


"[…] a design review double checks that the parts that he [the programmer] thought he had right he did have right and potentially give him some insight on the parts that he didn't. […] such an obvious good use of the senior talent doing the review."
Bernie Cosell, p. 539


"[…] software required so much attention to detail. It filled that much of my brain to the exclusion of other stuff."

"I think it is always going to be true that a person who manages programmers should not expect it to be predictable."
Donald Knuth, p. 572

2010-03-25

Merge (fka Upsert) Extension Method for IDictionary

[TestFixture]
public class IDictionaryExtensionsTests
{
    [Test]
    public void ShouldAddIfKeyDoesNotExists()
    {
        var dictionary = new Dictionary<string, int> { { "nøgle", 100 }, { "key", 200 } };

        dictionary.Merge("nyckel", 300).Count.Should().Be.EqualTo(3);
    }

    [Test]
    public void ShouldUpdateIfKeyExists()
    {
        var dictionary = new Dictionary<string, int> { { "nøgle", 100 }, { "key", 200 } };

        dictionary.Merge("nøgle", 400).Count.Should().Be.EqualTo(2);
        dictionary["nøgle"].Should().Be.EqualTo(400);
    }
}

/// <summary>
/// Adds the key/value pair if the key doesn't exist, or updates the key with
/// the supplied value if the key exists.
/// <remarks>
/// The name "Merge" is taken from SQL:2003 (f.k.a. "Upsert")
/// <see cref="en.wikipedia.org/wiki/Merge_(SQL)"/>
/// </remarks>
/// </summary>
public static class IDictionaryExtensions
{
    public static IDictionary<TKey, TValue> Merge<TKey, TValue>(this IDictionary<TKey, TValue> thiz, TKey key, TValue value)
    {
        if (thiz.ContainsKey(key))
        {
            thiz.Remove(key);
        }

        thiz.Add(key, value);

        return thiz;
    }
}

2010-02-12

YAK - Yet Another Keyboard Navigator for Chrome

I wanted to learn some basic jQuery, and I wanted a simple ergonomic keyboard navigator for Chrome: meet YAK! 


I implemented it as a user/Greasemonkey script, which will pass as an extension in Chrome.


YAK web site: http://yak.nfshost.com/


YAK @ userscripts.org: http://userscripts.org/scripts/show/68609

2010-02-10

Poor Man's Custom Types with C# Using Aliases

For the sake of simplicity, I never implement custom types just for the sake of readability. I.e., I don't encapsulate int, string, decimal, and so on. This is because I find the cost being too high when writing, maintaining, and (OR) mapping all these types.


What I've just started doing in order to achieve the same level of readability, is using aliases like so:

using Birthday = DateTime;
using PersonId = Int32;
before the class declaration, but after the namespace declaration (so that one doesn't have to fully qualify the type names).

For complex generic types, the readability increases even more IMHO:
using StrangeDictionary = IDictionary<int, KeyValuePair<string, decimal>>;

/Martin