Thursday, December 9, 2010

'Taking it too far' v 'Taking too much time'

Coderetreat is about spending the day writing perfect code. During our day-to-day programming tasks, whether they are for pay or our side-projects, we always have the end goal of getting something done. This inevitably causes us to cut corners, writing less-than-perfect code. Why do we do this? For one, it is because writing the code that we 'know we should write' will take too long. We have to weigh the value of merciless refactoring and ultimate clean code with the reality of the benefit we get from delivering something. At coderetreat, though, the pressure to finish goes away, deleting the code makes it so that you can't finish the problem. This allows us the freedom to act as though we have an infinite amount of time.

As I've traveled around and had the opportunity to work with people of widely varying experience and skill level, I've noticed that the big difference is which corners get cut. For people with less experience, say 1-5 years, the 'get it done' code is significantly different, less clean, than the code written by those with a lot more experience, say 15-20 years, yet written in the same amount of time. This makes sense and isn't a knock against beginners, it is just a good indication that there is always more to learn. The gap between what we actually write and what we think we would write given enough time is always there, just at a different level. As we gain more experience, that gap simply moves upward, so the code is cleaner given the same constraints.

I've facilitated a lot of coderetreats. I've watched people of widely varying skill levels work on the same problem. Some will write very readable code, others will write less readable code. My role as a facilitator is to ask the questions about the code, questioning the refactoring decisions, and, more often, helping people understand why they stopped refactoring.

Suppose you have this method, a very common one used to figure out whether a living cell will die in Conway's Game of Life:



Commonly a team arrives at this and moves to the next test. I'll ask if they aren't skimping a bit on the refactoring and get a response similar to "well, we don't want to go too far" or "this is very readable." I'll generally add a little code:



That is clearly more readable; most teams that see this small change agree. My question is "why did you stop?" The readability also exposes a few other problems, mostly around the method names, but that is a topic for a different blog post. So, the question remains "why is the first form 'good enough'?" After all, the extracted version is more readable, captures the domain better (underpopulated vs a cryptic number comparison) and is not much more work to extract, especially with basic refactoring support.

[Just a note here that this is not the absolute end state of the system, but an intermediate step along the way of evolving the design. If teams get that far, this usually ends up being extracted into another object that resolves some of the design issues inherent in it.]

One hypothesis is that we often mix up the idea of "going to far" with "taking too much time." After all, I would be surprised if someone would say that the extracted version truly is taking it too far. However, I do believe that some people would argue that it might take them too much time to do this all the time. I've worked with people who didn't have a good understanding of their toolsets, so this sort of extraction would take more time: manually extracting it doesn't take a lot of time, but it is definitely non-zero. So, creating code like this is time-consuming on a larger scale, so we don't do it. This, though, is really about "taking too much time."

Another hypothesis is that we aren't comfortable with more abstractions. For various reasons, most of us don't have a great familiarity and comfort with abstractions. One difference I've noticed between people with varying experience levels is a view on abstractions and how they handle them. I like to say that programming is based a lot on just being adept at abstraction wrangling, and my experiences with people has shown me that this has more than a hint of truth to it. As we encounter the creation and manipulation of abstractions, we get a better sense of where they are hiding in the system and how to be effective in drawing them out into the open. A common argument against heavy abstraction is that you then have to jump around the system to see what is 'really' going on. For people who are truly comfortable with it, though, you either don't need to see what is 'really' going on, relying on the names to truly reveal their intent. And, when you do need to see what a specific part of the system is doing, navigation can be a trivial act, due to a clear signpost guiding you to your destination.


These are just musings of mine. I don't have the answers; these thoughts are based on my experiences pairing with different people and watching people of various levels writing the same problem over and over at coderetreats. I'd love to hear any ideas that others have either in comments or as blog posts. I think this is an important topic that can help us understand ourselves better both as a means of accurate self-assessment and developing more effective training mechanisms.

Monday, November 1, 2010

Positivember

At the 2010 Software Craftsmanship North America conference (SCNA), I was given the honor of giving the closing talk, titled "The Long Road Ahead." (watch here) My goal was to focus on where we had come and where we are going as a movement, not only looking into the previous year's activity, but also what might stand in our way of spreading the ideas of craftsmanship to the general programming communities.

As I was preparing, several conference talks influenced my thoughts and the focus of my presentation.

At jRubyConf, Joe O'Brien gave a wonderful talk about how the people around us are not stupid and not worthy of the scorn often laid upon them. Instead, we should consider them experts in their domain helping us better build the software we are hired to make. At the same conference, Glen Vanderberg provided a informed view of the problems with the term "software engineering," and what we might do to establish ourselves as a true engineering discipline, all the while capturing and celebrating the artistic, creative bent on which we pride ourselves.

At SCNA, Doug Bradbury gave a great talk on our inclination to build, to make; we need to get back to our roots, back to our core qualities as makers.  Deep down, we are all creators; we start with nothing but a blank screen, and we put our hearts and souls into the creation of something real, something that acts and solves problems. We write new creation myths every day, except ours reach up out of myth and into reality. Chad Fowler gave an inspiring talk on readdressing what we thought of as quality, putting forth the challenge to merge the realms of art and utility. Often, we hear the argument that the craftsmanship principles are unrealistic and potentially harmful to production; Chad's talk was a refreshing counter to these, showing that we can support both.

While there is no 'craftsmanship canon,' these talks, for me, cut to the core of the craftsmanship manifesto, highlighting the fundamentals of what we do and care about. They were wonderful examples of how the fundamentals have crystallized over the past two years. Looking forward, the question of spreading the ideas is moving into the spotlight. The ideals are sound, so what could stand in the way?

Considering the topic of what might hold us back, I watched the mailing lists, I read blog posts, and I paid attention to the twitter stream. I thought about what would set us apart as a movement, and, on a larger scale, what were some hurdles that the software industry as a whole faced. There were a lot of thoughts, but one thing really stood out: we are an overwhelmingly negative group. We complain about our hours, we complain about our jobs, we complain about our coworkers, we complain our toolsets. If we are going to become better, we need to change this.

I believe that a significant factor impeding us in the goal of selling to those around us the care and professionalism espoused by the craftsmanship movement is the negativity we propogate. So, in my SCNA talk, I challenged the audience to take part in what I am calling "positivember." That is, one month, just one month, where we guard ourselves from the trap of negativity, during which we filter ourselves from taking part in the easy trap of those little comments that we put on twitter, the offhand remarks that we make on our blogs, the complains we focus on when we spend time in person. One month where we put forward an air of positivity in all of our dealings. What would happen if we all did this? What would be the result if we took a minute before we complained, a moment to reflect on whether our dissatisfaction is because of our own choices, those decisions we have made about our tools, our coworkers, our entire work environment?

So, I ask each and every one of you to take part in this grand experiment: spend a single month portraying only positivity and happiness in what we do. After all, we have one of the greatest jobs there is. We get paid to do that which we gladly do for fun, for a hobby. I spent my teen years programming, relishing the thrill of creation, the thrill of making. Now, more than 20 years later, I get paid to do this. We all do.

Join with me this November to celebrate the beauty and happiness in what we do. Try to take a moment to filter every outward expression of yourself and look for the joy in what we do. We all get frustrated at times; the world isn't perfect. But, if we can take a second to reflect and focus on the positive, maybe that will actually have an effect on our industry, and on our world.

The hashtag for this is #positivember. This word captures the essence of the movement: 'positiv' stands for looking forward, appreciating the life of creation that we have built for ourselves, being proud of what we are doing; 'ember' is hungarian for 'person,' the simple link that this is about us as individuals. So, I ask you to help spread the word: tweet about it; blog about it; talk about it. Most of all, present yourself as a happy, positive person who cares about what they do. As people see that those of us who care are happy, they will want to know why. When they ask, we can proudly say, "I love what I do. I'm happy doing what I love."

And, in the end, I believe this to be the only way we can convince others to follow along. Will you join us?

Help support #positivember

  • Please vote for this on Digg, so we can get more people taking part.
  • Do you have a podcast? Please give us a shoutout. I'm also available for short interviews about the motivation behind it.

Monday, July 19, 2010

Learn To Type Week - Recap

(interested in what all the fuss is about? Read the original post)

Wow! It has been a great week of typing practices. Lots of people took up the challenge and began practicing home-row touch-typing. There were people who were starting from scratch, unlearning years of existing techniques, and some who took the opportunity for further refinement, perhaps getting those pesky numbers and symbols under control (something most people have trouble with). A bunch of people frequented typeracer.com for incredibly fun car-racing action. At Eden Labs, they even did a video of two employees racing (Aimee Daniells and Tom Crayford). Watch and see what it looks like when someone types 100+ wpm.

Rather than write a teary-eyed, looking-back account of the journey through the week, I'll end with a challenge: Keep It Up! This week was an intense series of 30-minute sessions every day, but it was just a start. If you continue to practice frequently, either while writing blog posts, coding or just doing focused transcription practices, you'll find your speed increasing and your errors decreasing. Transcription is an important way to learn and practice the techniques, but the real stuff comes when you are producing content. Write a blog post with a paper over your hands. How did it feel? When you get back to coding, are you looking at your hands when you hit the funky symbols, like ( or { or [? If so, why not do some practices to get those under control.

And remember, typing is a fundamental skill, not just in coding, but these days, in life. Is it the only skill you need as a developer? Not by a long shot. However, chipping away at impediments to getting your ideas out there is an important step towards improving your competency. Having a strong and fluid command of your keyboard is a valuable first step towards the goal of mastering your toolset.

Thursday, July 15, 2010

Learn To Type Week - Day 4

(interested in what all the fuss is about? Read the original post)

So, Day 4! How quickly time flies when you are typing, eh?

This week has been amazing. I've talked to people who are taking the time to unlearning years-learned techniques in the effort to improve their typing skills. Others already type from home row, but they realized they don't have a good feel for the number/symbol row. More people are discovering "Learn To Type Week" and starting at the beginning. And, of course, there is the typeracer.com racing. It is a blast to sit and let my fingers fly around the keyboard, totally balls-out.

Speaking of typeracer.com, Eden Development realized a video of two of their people, Tom Crayford and Aimee Daniells racing. (@t_crayford and @sermoa) Hilarious! Go watch what 90-100+ wpm fingers look like.

So, my advice for today is about the same: continue the path you've started. Watch the #learn2typewk search on twitter, so you can keep up with the others who are doing it. As a community, we can keep ourselves motivated in our practice. A great way you could practice what you've learned so far is to write a halfway-mark blog post about your experiences. In our day-to-day lives, we rarely do transcription, instead we are typing while producing. Writing a blog post will allow you the opportunity to apply what you've done these past days to a more real-world situation. And, as a bonus, it will spread the word.

See you on the #learn2typewk racetrack! If you want to send the racetrack link to others, you can use the shortened url: http://vurl.me/TEL.

Wednesday, July 14, 2010

Learn To Type Week - Day 3

(interested in what all the fuss is about? Read the original post)

Wow! Another day has gone by in "Learn To Type" week. I've had a great time watching people mark their progress on twitter (hashtag: #learn2typewk): everything from home row stats to switching to dvorak. I'd highly recommend putting a persistent search into your twitter client for #learn2typewk, so you can see all the people who are working with you. Tomorrow is Day 3! Almost halfway done, so don't despair, we're almost there!

There are a lot of people putting their speeds and accuracy counts up; it is really neat to see the improvement. Now that 2 days have gone by, try to set a realistic goal for the end of the week. Speed isn't what it is about, though, perhaps you want to consistently type effectively for all the rows without looking.

What to do today?

As always, I recommend starting with a baseline: freetypinggame.net's 1-, 3- or 5-minute tests. Then, continue the practicing you started.

I've noticed that when I'm doing practices, I find it easy to stay on a single one until I've 'mastered' it. So, I might be practicing the home row keys and find that I have them down, but maybe I could do them faster. Don't worry about the speed, just move on to the next exercise. Remember, speed comes once the techniques are in place.

As always, don't forget to intersperse your practice with fun! Typeracer.com is a great way to reap the benefits of all that practice. I'm keeping the racetrack open at http://vurl.me/TEL, so feel free to post a challenge on twitter with the hashtag #learn2typewk. If you are registered on the site, you can create your own track too and put out a private challenge.

Just think, no matter what, if you participate, you will win! Huzzah! That's more than can be said for a lot of things.

Tuesday, July 13, 2010

Learn To Type Week - Day 2

(interested in what all the fuss is about? Read the original post)

Good morning, everyone! I meant to have this up last night, but I misjudged my timing. Sorry to the people in Europe, already being long into the afternoon and all.

Day 2! I've been excited to see how much the response and participation from people for "Learn To Type" week. There are people who are trying to learn to touch-type for the first time, people working hard to overcome years of bad technique, people who are moving from QWERTY to Dvorak, and loads and loads of racing on typeracer.com. But remember it isn't about your speed, it is about your technique. Speed will come, but technique and form is what we are practicing. Of course, everyone needs fun, so we meet on typeracer for some balls-out typing competition.

What to do today?

I would recommend starting with a baseline on freetypinggame.net's 1-, 3- or 5-minute tests. Then, continue with the lessons you started yesterday.

If you have started some lessons, continue them. How are you feeling on the home row? Move on to the lessons that include other parts of the keyboard. I would recommend you keep on the path you started yesterday, as those lessons are built for incremental learning.

If you already touch-type, but are working on your form, then I highly recommend doing a few 5-minute tests on freetypinggame.net; I like the fairy tales. My goal this week is to make it all the way through #26: the cobbler and the elves (not to be confused with the keebler elves).

Don't forget to intersperse it with some fun. If you want to take a break, then head on over to typeracer.com. I'll be keeping the coreyhaines track open, so you should be able to use that as a primary meeting point if you want to race other "Learn To Type Week" participants. If you want to call some people into a game, you can post the shortened url http://vurl.me/TEL on twitter with the hashtag #learn2typewk; people might be up for a race. Otherwise, go on the open tracks and race away.

And remember, it isn't about where you are today (no cries of 'I Suck!'), but about where you will be soon (only cries of 'I'm getting better!').

Keep it up today!

Sunday, July 11, 2010

Learn To Type Week - Day 1

As I wrote in my last blog post, tomorrow starts "Learn To Type Week." What does this mean? I encourage you to read that post to understand the motivation. For now, though, let's talk about this week. We had a lot of fun over the past couple days with typeracer.com, and I hope to keep having fun with it, but now starts the work for the week.

I will be writing a blog post every night with some ideas and encouragement to keep you going through this week, spending 30 minutes a day working on your touch-typing. Are you already touch-typing? Maybe you want to spend the time improving your speed. Or, work on the top row (numbers/symbols).

On Day 1, first thing, here's my recommendation: go here and do either a 1-, 3- or 5-minute test. If you are just starting to touch-type, then do the 1-minute test; if you are an experienced touch-typist, do the 5-miute. But here's the catch: do it with a piece of paper over your hands: no peeking! The key for this is not to do it quickly, but to do it with 0 mistakes. This is your real touch-typing speed. So, do it a couple times, if you want, until you are satisfied. This is what you are going to measure yourself against over the course of the week. After you do that, mark it down. Why not put it on twitter or your blog? Let's do this together, and we will be more likely to keep it up and encourage each other.

Now, choose your typing lessons (I have some links on the original blog post, and you can always google for them) and start. Are you just learning to touch-type with home row? Then start going through the step-by-step tutorials. Are you an experienced home-row touch-typist wanting to get better? Maybe do the 5-minute typing test a couple times, interspersing a few trips to typeracer.com. Go to this site and play some games: what's your best score at Keyboard Revolution? Gotta Love The Duck!

Tomorrow, we'll reconvene and do some more.

And remember, this isn't about where you are now (no cries of 'I Suck!' only cries of 'I'm Getting Better!'), but where you are going to be, where you'll be in a week. So, try to make positive comments about your status. Believe me, it will help.

Hashtag: #learn2typewk