Thursday, June 25, 2009

Big O for all you fellows who slept through the algorithms course

http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/

Tuesday, May 5, 2009

Mathematicians should never code alone.

Case in point:



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if (xGrad * yGrad <= (float) 0 /*(1)*/
? Math.abs(xGrad) >= Math.abs(yGrad) /*(2)*/
? (tmp = Math.abs(xGrad * gradMag)) >= Math.abs(yGrad * neMag - (xGrad + yGrad) * eMag) /*(3)*/
&& tmp > Math.abs(yGrad * swMag - (xGrad + yGrad) * wMag) /*(4)*/
: (tmp = Math.abs(yGrad * gradMag)) >= Math.abs(xGrad * neMag - (yGrad + xGrad) * nMag) /*(3)*/
&& tmp > Math.abs(xGrad * swMag - (yGrad + xGrad) * sMag) /*(4)*/
: Math.abs(xGrad) >= Math.abs(yGrad) /*(2)*/
? (tmp = Math.abs(xGrad * gradMag)) >= Math.abs(yGrad * seMag + (xGrad - yGrad) * eMag) /*(3)*/
&& tmp > Math.abs(yGrad * nwMag + (xGrad - yGrad) * wMag) /*(4)*/
: (tmp = Math.abs(yGrad * gradMag)) >= Math.abs(xGrad * seMag + (yGrad - xGrad) * sMag) /*(3)*/
&& tmp > Math.abs(xGrad * nwMag + (yGrad - xGrad) * nMag) /*(4)*/
) {
magnitude[index] = gradMag >= MAGNITUDE_LIMIT ? MAGNITUDE_MAX : (int) (MAGNITUDE_SCALE * gradMag);
//NOTE: The orientation of the edge is not employed by this
//implementation. It is a simple matter to compute it at
//this point as: Math.atan2(yGrad, xGrad);
} else {
magnitude[index] = 0;
}

Thursday, April 30, 2009

Ruby's object.methods reflection in Scala

Update: Just found out the Scala REPL in trunk has tab completion, which does pretty much exactly this with a lot less fuss. Cool.

If you're coming from the Ruby world to learn Scala you'll learn quickly how much you miss Ruby's elegant reflection. On day 5 of my Scala adventure I took a crack at using Java's reflection APIs to do the job. I think it worked out pretty well. I'd love to hear what you think about it.

get the code here



1
2
3
4
5
//names of all methods, including super classes
namesOf(methods("Foo"))

//signatures of all methods, excluding super classes
signaturesOf(declaredMethods("Foo"))

Wednesday, April 29, 2009

Hacking tail call optimization into ruby

Found this via Twitter. Really interesting hack.

http://judofyr.net/posts/tailin-ruby.html

Tuesday, April 21, 2009

.:format feature breaks URL compliance (rfc1738) in Rails

I put in a lighthouse ticket in Rails which you can read here. +1 me if you agree.

Tuesday, March 31, 2009

Software Craftsmanship > Certification

There's been a lot of discussion about Agile Certification, a Rails Maturity Model, and some such. Are we always doomed to repeat the mistakes of the past? Remember the MS/Java/Sun/Linux certification craze of a few years ago? Yeah, same thing.

I did some hiring back then. I'd float right over any resume that prominently listed a big set of certifications because I thought people that misguided couldn't have a clue as to how real software systems are built. Mostly I think I was right. The first resume I see sporting a Rails or Agile certification is going to get framed and put on The Wall of Shame. I don't have a Wall of Shame, but I'll create one just for it. I promise.

For those of you coming into this industry, coming into Agile or Rails. Or for those somewhat experienced fellows looking for what to do next. Certification is not the answer. Let me now bestow upon you the few truths I know about this:

First.
I can tell you with much certainty that there is only one way to learn how to build great software: from a master. I read this Chinese proverb once and it stuck with me:

A single conversation with a wise man is better than ten years of study.

A bit of an exaggeration, I know, but truth none the less. Nothing compares to working day in and day out with a master of the craft. Literature, conferences, training. They're all good places to start, but they are not enough. You need a mentor, the best one you can find.

Second. It will take you years of hard work to become generally competent. I've been at it for about seven years now and I feel as if I've climbed to stand upon one great peak of knowledge only to look down on the vastness of my ignorance. Yes that was as bit dramatic. I apologize.

Third. The only way to gauge the true skill of a craftsman (that's you) or organization is by their work and the opinions of their colleges. Not where you got your graduate degree, especially not the number of certifications pinned to your wall.

Now that I have you convinced. What can you do? How can you apprentice yourself to a master?

Most are not terribly hard to find. They write lots of books, they have blogs, they speak at conferences. Find one who's style resonates with you, then figure out how to get your foot in the door wherever their opinions hold sway. If it does not work out, find someone else and try again. And again.

If you wanted to get your foot in the door with us, for instance, you can undertake an apprenticeship. Otherwise, There are a lot of great places to learn this craft beyond our doors. I know this list is short, but here's the few companies I can recommend (mostly in the Chicago area): Obtiva, 8th light, Atomic Object, Object Mentor, ThoughtWorks.

Friday, March 6, 2009

Join the Software Craftsmanship community!

Interested in Software Craftsmanship but haven't found a good peer group to share your thoughts with? Then this google group is for you.

http://groups.google.com/group/software_craftsmanship/