codethinked (kōdthĭngked) adj. To be consumed by or obsessed with code.

Multi-Threaded K-Means Clustering in .NET 4.0

A little while back I gave a presentation on the some of the new parallel features of .NET 4.0. One of the demos I had prepared was a K-Means clustering application since it provided an embarrassingly parallel algorithm to show off the power of the new parallel libraries. Recently I was going through some of my directories and I saw the demo folder and I realized that I had never posted it up on my blog! So that is what I am going to do today.

Explaining the K-Means Clustering Algorithm

The K-Means clustering algorithm is really quite simple. It is all about taking a set of items and then placing them in an arbitrary number of groups according to their “distance” from each other. In order to explain the algorithm, I am going to start off with a very simple example in a 2 dimensional plane. First we start off with a bunch of points in our plane:

Continue reading the rest of this post...

The Most Intriguing Concept In Google's Go Language

If you have been anywhere near the geekier parts of the internet lately then you are probably numb from hearing all the chatter about Google’s new language called "Go". I saw a few links to it from reddit, and I thought, "yay, another language to look at." Yes, that is actually what I thought, I know, I’m weird. Upon reaching the Go site, and doing a few quick cursory glances, I found myself quite repulsed. And I don’t mean repulsed in that it is a bad language, but repulsed in that it is a language which is designed for a world entirely outside of the one that I work in on a daily basis.

I mean, Go looked ugly to me. Sure, Rob Pike and Ken Thompson were working on it, but that is exactly the reason why it is so hideous to me. They are hardcore C and Unix kernel types guys, whereas I like my languages to be a little higher level. I want my languages to lean more heavily in the “developer productivity” camp, rather than the "machine productivity" camp. But to be fair, Go is a systems programming language, and so after reading their goals for the language I feel that they are heading in a really good direction (Not that they care at all how I feel).

Continue reading the rest of this post...

A Move Into The Cloud Is Inevitable

The other night at the local Software Craftsmanship Group meeting we began discussing the business case for the “cloud”, and whether or not we thought that companies would truly embrace it. It was a good discussion, and I wanted to capture some thoughts in a blog post, so here we are.

Initial Thoughts

First, I think that a move from computing as we know it now into a “cloud” environment is an inevitable conclusion. As my good friend Kevin Hazzard said at the meeting, computing really started out with a bunch of little clouds. A few universities had the resources and money to setup giant mainframes and then people would keep all of their data on these mainframes and log in through a dumb terminal in order to get time slices for running computations from their datasets. Or maybe they just needed a slice to read a document. Everything was done on big centralized computers.

When computers started getting smaller and PCs came about, things started shifting toward the model of having computing resources decentralized so that everyone had computing power on their own desk. When the web came around and some of the bigger companies decided that they needed to setup websites they started hosting servers inside of their own offices. They would build server rooms with fast internet connections, lots of air conditioning, raised floors, racks, etc… Even companies that weren’t all that large had these rooms, talk about a waste of money! As commercial datacenters became more popular only very large companies could still see a benefit from hosting their own hardware. As of today, it makes no more sense for most companies to buy and maintain their own datacenter than it would for them to go and build a power plant in order to produce their own electricity.

Continue reading the rest of this post...

It’s Okay To Write Unit Tests

I hate these posts. I hate them because I feel like I am drawing attention to another post which made me cringe a little bit. But I think that reacting to these posts is good, because having a healthy debate about topics is good, especially if you can keep from devolving into mud slinging and attacks. The post I am talking about is this one, which is titled “It’s OK Not to Write Unit Tests”. I was surprised to see that it is actually from March of this year, and maybe I have seen it before, maybe not, but this time I felt the need to respond to it.

One thing that I want to say first is that I want to keep this calm and mellow. I used to react very calmly in retort to this kind of post, but over time as I wrote more and more on my blog, I found myself starting to become the “everything is black and white and I’m going to tell you that you’re wrong with my blaring megaphone” kind of writer that I often loathe when I read. Sure, it might not make the best link-bait in the world, but maybe I’ll feel a bit better after I write it. Oh, and the blood pressure might stay down a little bit. Having said all that, here we go…

Continue reading the rest of this post...

Learning Scala via C# Part 3 – Getting Loopy

Welcome back! In the last part of this series we took a quick look at how you declare immutable variables, then looked at the “everything is an object” features of Scala, and now we are going to jump back into some simple variable declarations, but this time we are going to look at creating mutable variables.

Mutable Variables

You might be wondering why we didn’t just go ahead and jump straight into mutable variables after discussing immutable variables, and the reason is that I wanted to give you a bit of advice before introducing them. Basically, Scala takes the stance that most things should be immutable and the developer should really only fall back to mutable objects when it makes sense from a complexity or performance standpoint.

Continue reading the rest of this post...