Setting Today in a Test

December 20th, 2006

Ruby is awesome…

  def test_on_weekday
    today_is "May 3, 2006" do
      calendar.add("a call").at(4.pm).on(:saturday)
 
      assert_equal(Time.local(2006, 5, 6, 16),
                 calendar.appointments.first.start)
    end
  end

…playing with code examples for our book.

Stand ups as Huddles

December 20th, 2006

We’ve been talking about stand ups here at ThoughtWorks.

I’m actually not a big fan of the traditional yesterday – today – issues format. I find that too often it becomes a status meeting – this is what I did yesterday, doing more of the same today, and no issues.

Instead of a status meeting, I like to treat it as a planning meeting. I prefer to think of a stand up like a huddle in American football. The point is to focus on today, and figure out a game plan that makes the most sense. Who needs to pair with whom? Who’s tackling what stories?

I find the signal to noise ratio is much higher in the latter format as is the energy. It’s fine to mention anything from yesterday that is especially pertinent or interesting to the team, but I think the focus should be on today.

Effective Writing

December 8th, 2006

Our publishers have given us a deadline of the end of the year to get 60 pages out for DSLs in Ruby. That’s not a lot of time, but honestly probably a really great thing for us. We needed the push.

Putting everything else on hold for the month, I’ve found myself scrambling to find a way to apply all the discipline that I have when programming to writing. It’s hard, and getting started is always the hardest part.

I’ve gone through many days of “working” yet getting nothing done. This is what I’ve learned, it’s working for me, maybe it will work for you :
——
h3. Work top down

I remember outlining when I was writing papers in school. I never particularly cared for it. I could pretty much keep the structure of my paper in my head and just write from that. Turns out that’s not actually true for a book. And it’s even less true when you are writing a book with 4 authors in 3 different timezones.

Get a loose outline for the whole book, and then as you write each chapter, outline that in detail. Work on one chapter at a time.

Question Driven Writing

XP has TDD to keep you honest. If it’s not making a test pass, you should delete it or write a test for it.

In a similar way, why not start a chapter by writing the questions it should answer. If you find yourself writing text that doesn’t answer one of those questions, delete it, or add the question.

Work in Sprints

I find I simply CAN NOT concentrate if I’m online and checking mail and talking to my roomates and answering IM’s… As damaging as switching context is when I’m coding, it’s several times more damaging when I’m writing.

The problem is that there’s always more to learn, so it’s way easy to get distracted. Oh, Joe’s online, let’s see if he knows about declarative programming. Let’s google for metaprogramming. Let’s download rBehave.

Even working on examples can be a rabbit hole. And with no pair to pull me back to what we should be doing, I’ve wasted weeks on not important stuff.

The solution?

Figure out what needs to get done next. Do some outlining or research or write some examples, whatever. Once you’re confident that you have some material to write about, start a sprint.

I’m using 2 hour increments, but I could probably do 3 or 4.

  1. Unplug the wifi, evdo or lan cable.
  2. Take a minute to think about what you’re about to do (call it a mini standup) tell someone if, say your girlfriend’s available
  3. Set your timer for 2 hours and write.

The rules are you have to be making forward progress. If you come up against any hurdles, want to ask someone a question, park it. Write it down on a card or a “todo.txt” file.

What do you do when you write?

DSLs vs. APIs

October 27th, 2006

Ever since Joe, Neal, Zak and I started working on our DSL book, we’ve had an outstanding question that we had no good concise and simple answer for.

How is a DSL different than an API?

We’ve spent hours talking, arguing and asking others how they would answer this question. Still the answers we’ve had so far have been too complicated and didn’t feel “right”, until today.

I just got back from breakfast w/ Rob Mee, and we talked about DSLs among other things. His answer to this question is far too simple, so simple, in fact that I think we might finally have it.

Unlike an API, a DSL has it’s own grammar.

But what if it’s an internal DSL? Well, it still has an implicit grammar over and above its host language grammar.
——
Rob has a background in Linguistics and drew parallels between the difference between Pidgin Languages and Creole Languages

A Pidgin Language is one that forms when adults from 2 disparate languages come into contact and try to communicate. It has a minimal grammar and verb forms. It often follows subject – verb – object order and uses extra words for tenses. There are no native speakers of a Pidgin Language.

However, when adults that speak a Pidgin Language teach it to their children, a funny thing happens : their children add grammar to it. They become native speakers and the language morphs into a Creole Language.

Creole Languages are much richer than their Pidgin parents. It’s possible to more easily express complex concepts in Creole than Pidgin. They have more structure and can be more concise and exact as a result.

Interesting.

(if you’re interested in Pidgin & Creole, Rob recommends The Language Instinct)

Fun with Closures in C# 2.0

June 22nd, 2006

One of my favorite features in C# 2.0 are the anonymous delegates. Your code starts to almost look like ruby :) . But hold on, they can be tricky.

Can you find the bug here?

Button[] digits = new Button[] {Zero, One, Two, Three};
for (int i = 0; i

——
Give up?

After executing this code, clicking any button would result in this ClickDigit being called with the value of 4 instead of the appropriate value between 0 and 3.
——
I groaned when I realized what it was. ClickDigit gets called with i in the state it is in when the button gets clicked – not when the event handler was attached.

Once you realize this, it’s very simple to fix it, even if it looks kind of strange.

So it should be :

Button[] digits = new Button[] {Zero, One, Two, Three};
for (int i = 0; i

Google’s Tiny Languages

June 21st, 2006

I am struck by how my friends, my english major, only use a computer for e-mail and myspace friends are unwittingly becoming programmers.

It’s all google’s fault.

They’ve gone and taught my friends some domain specific languages. Any of this look familiar?

chinese near 5503 roosevelt way, seattle

on google maps. Or

dentist appointment in seattle from 4pm to 5pm

on google calendar.

What is this world coming to? And more importantly, if “dentist appointment from 4pm to 5pm” is a DSL, what about the interface that lets you select an appointment over that same time period by dragging and dropping? Where is the line between DSL and UI? Or is it starting to blur a little?

Natural Language Programming

June 21st, 2006


Programming games is an activity. A programming language is a kind of thing. Inform 7 is a kind of programming language. It is either the single-most important advance in interactive fiction in a decade, or an interesting idea doomed to fail.

– Liza Daly, Inside Inform 7

The above is source code. It is a dsl, kind of, but it’s a particular kind of dsl that is trying to look and feel like natural language. It is completely readable by a non-programmer, and I dare say it’s writeable by one too. It is Inform 7 , one of the coolest things I have seen in a while. (see Beyond Domain Specific Languages )

Put this together with the simple little DSLs that google is doing or the internal natural language-ish DSLs that my colleague Jay Fields has been working on in ruby, and I think we are beginning to see people approach programming in a new way.

This is definitely stuff that we’ll talk about in our upcoming DSLs in Ruby book. But more importantly, it might be stuff that I use on my next project!
——
Above and beyond the language, there is also a sweet IDE for Inform 7. We’ll be looking at what we can learn from it here at Intentional. You should too.

It has a simple UI, is targeted toward non programmers, and is very polished and well thought out. Good stuff.

The Path to Unconscious Competence

June 5th, 2006

Last month I was talking to Pat Gremo, a fellow ThoughtWorker, about stages of learning. He learned this learning model from karate. Two weeks ago, I found myself repeating it to a room full of Swing Dance teachers who were extremely interested in it. I really enjoy pulling and applying this type of omnirelevant stuff from and to disciplines as ostensibly distinct and separate as martial arts, software development, or dance.
——

Stage 1 – Unconscious Incompetence

At this stage, the student does not know what they don’t know. They either have no interest in improving the skill, or they don’t even know there is room for improvement.

When I first played with a typewriter, I was blissfully unaware that I didn’t know how to type – I was a little kid. I think I eventually taught myself how to type with my index finger.

Stage 2 – Conscious Incompetence

At this stage, the student understands where they are, they can see the difference between their level of competency and that of someone who has mastered the skill.

I soon became aware that my parents and teachers could type much faster than me. It was annoying, but I didn’t really know what I could do about it…they somehow used all of their fingers.

Stage 3 – Conscious Competence

At this stage, the student has learned the skill enough that they can do it while thinking about it. However, it often requires a great deal of concentration.

After a few weeks of playing with a typing program in the school computer literacy class, I could touch type. I could actually go pretty fast, especially compared to me before. However, in order to type anything, I had to have the complete thought, then hold each word in my mind as my fingers struggled for the keys. The process was very serial, and it led to errors, because I’d often lose my place in my thought while I was thinking about typing.

Stage 4 – Unconscious Competence

At this stage, the student no longer has to think about the skill while performing it. It is at this stage when the skill becomes second nature and a reflex. This is very distinct from the previous stage, and at this stage you can add more things on top of what has been learned.

After many more weeks and eventually years of typing, I started getting to the stage where I didn’t have to think about typing at all. In fact I now don’t have to think about each character at. I just think each word, and sometimes I don’t even have to do that. I can be thinking of the next thing I’m going to write while making a correction on the previous line. The speed of my typing is obviously much faster than it used to be – and also the quality of what I type is better.

see also Four Stages of Competence
——
h2. Other Learning Models

There are many different learning models, it’s often helpful to cycle through several to find one that might be more applicable or helpful when you are either teaching or learning.

At the swing dance teaching workshop that I took last week, we talked a lot about identifying how your students learn. Are they visual, auditory, kinesthetic learners? Do they approach problems from a global or linear fashion? Can you teach something hitting all of these at the same time? Or can you customize your teaching style for your student?

Another of my favorites for a long time now is the one Alistair Cockburn talks about in Agile Software Development. He basically separates learning into 3 stages, following, detaching, and fluent – but that’s another blog post ;)

I live for this stuff. After all, I am primarily a teacher, whatever my business card says.

Self Hosting Sucks

May 16th, 2006

At least when I do it…

Every since my hard drive died on my server and my site went down, I’ve been looking for alternatives to self hosting. Fact is, I’ve learned everything I set out to learn from running my own server and it’s a pain in the ass. This blog for example is now hosted on TextDrive – and I’m totally happy with their service.

However, I still had to find some place to put all my pictures. If y’all remember my “Shimmer” project, I had them all accessible from the web through my own self hosted portal. I really liked that. I had been thinking about Flickr and ShutterFly, and even using Amazon’s S3 through my own custom frontend.

I think for now I’m going to go with Flickr. Why?

h3.Good

  • Great UI - as of today, some of the best AJAX stuff I’ve seen anywhere
  • $24 / year
  • unlimited storage
  • even if you default on your account they don’t delete anything

h3.Bad

  • They won’t store video – I store video that my camera takes along with my pictures

So even though they don’t have video, I think I want to go with them for photos. I’m gonna have to keep looking for a solution for my videos.

Here’s a link

ThoughtWorks US Away Day 2006

February 22nd, 2006

Good Lord.

What a weekend.

So just a couple weeks ago, I had an empty plate. I was looking for projects and things to fill my time.

Well, I found some.

ThoughtWorks had its away day this past weekend in Chicago and it was quite possibly the most inspiring weekend (work wise at least) I’ve ever had.

I’m sitting here at the airport in a daze, exhausted and excited. On my ‘plate’? you will now see :

  • A book on DSLs – Joe O’Brien and I are going to be pairing on a book. My first. We’re still nailing down exactly what it’s going to be about, but this is pretty damn exciting. I’m going to be an author
  • Chizzle Reborn – Jon Tirsen and I are going to take another crack at writing an open source ruby IDE. No wxWindows this time though, this one’s going to live in your browser. I’ll be blogging more about this later, but after a week of spiking, we’ve pretty much proven that we can make it work.
  • DSLs by example – I gotta get myself talking again, so I’m putting this talk together to get myself back on the conference circuit
  • Working with BD in Seattle – I like Seattle, I’d like to keep working there. It’s about time I get up and do what I can to help ThoughtWorks sell some work there.
  • Working with Microsoft – They’re not that bad. Seriously, though, I’ve volunteered myself to help out with MS stuff seeing as how I’m in Seattle these days.
  • Going to OZ - Julian Boot is using Rails to do some pretty amazing things with a client down in OZ. We’ll see if he can get me out there for a month or so sometime this year.
  • Pairing on Quickstart Training – Luke Barrett is teaching a course in a month or two on this pretty amazing new service offering TW has. I get to help him out with it.

So that’s basically the rest of my year right there

The book story.

O’Brien pulls me aside as I’m walking to a breakout session and asks me if I want to write a book with him. He says it’s about DSLs and I basically love the idea. Keep in mind that I just met the guy a week and a half ago, but we paired on code together and talked a lot. He’s good people.

So we go downstairs and start brainstorming on index cards right away and Neal Ford joins us. Not only an author, Neal’s been giving talks about DSL’s at No Fluff lately. Then Rebecca Parsons just happens to sit down with us, she proceeds to give us all kinds of great ideas that the three of us hadn’t come up with yet. Then of course Prag Dave sits down at our table, and yes he’s been looking for a book on the subject. And yes we should get him a proposal right away.

Wow.

…and that was just 2 hours out of a weekend that blew my mind. Damn. It’s good to remember the kind of company I work for :)