I've read a number of books about Test-Driven Development. There are a number of new ones, but most of them start with a clean slate where you're writing code from scratch.
Working Effectively with Legacy Code is different. It starts with the assumption that you already have a codebase that doesn't have tests and need to figure out how to start adding tests as you work on the existing codebase.
The book is organized into two sections. "The Mechanics of Change" are an introduction to TDD, tools, why you would want to do it, etc. The real meat of the book is the second section, "Changing Software". Each chapter in this section addresses a different question, such as:
And each chapter has a detailed discussion of the problem, the strategy or strategies you might use, and the tradeoffs involved. That last point is pretty important - the Agile community has more than its share of zealots, so there's a lot of dogmatic advice out there. This book is the opposite - the author has clearly spent a ton of time applying his techniques to real codebases, and there are lots of interesting discussions out there. Even if you aren't sold on the whole Test-Driven approach, there's a lot of content that will apply to general refactoring.
This is one of the best books I've read in the last few years. Highly recommended.
Not sure how I missed this earlier, but there's a version of C# that runs on the Lego mindstorm brick. Or, to be a little more correct, this group is building two things:
The first one - which is working now - is a tiny .NET runtime for the mindstorms brick. You create and build your project in VS, copy it over to the brick, and it runs.
The second one is a project to take .NET IL and convert it to native code, so that you could run on the microcontroller without the overhead of the runtime.
I'll be playing with this in my copious amounts of free time.
There is a new option for post-existence planning. Rather than being buried or cremated, you can go through the process known as Promession, where you are dipped in liquid nitrogen, vibrated into powder, freeze-dried, and then buried in a biodegradable coffin made out of potato or corn starch.
And, of course, a Promatorium is where this would be conducted.
I've always planned on being cremated, but I've have lots of fun freezing things in liquid nitrogen and then breaking them (there are some nice perks when your wife is a chemistry teacher), so this seems like an interesting option. The first Promatorium has been approved in Sweden, but there should be ample time for it to be available in the US.
This isn't related to these guys...
Okay, so I came clean about owning "Lost in Love" by Air Supply. I'll add to that - at the same time, I also owned the first album by Christopher Cross.
What is your most embarassing album? CDs are okay if you've never owned vinyl...
A couple of blog comments sparked the following question from Chris:
As I rode the Zoo my heart-rate hovered between 180 and 184. 184 is the absolute highest I have ever seen for me on a bike. My resting heart rate is roughly 56. Out of curiosity.... can anyone explain what it means that I have a higher resting heart rate and apparently a higher max heartrate than Eric.
That's simple. I have achieved the morally superior lower heartrate, and it doesn't matter how much faster you are, I'm going to be the better cyclist.
Don't buy that? Well, it's a simply matter of physiology. We aren't surprised that certain people have larger hands, or heads, or ears than others, so it's probably not a surprise that people have different sized hearts. My heart is simply bigger than yours. In fact, the stroke volume (the amount of blood pumped per beat) can vary as much as 4x between people. That's an impressive difference, though it would admittedly be more impressive if I hadn't pulled that "4x" number out of thin air.
I used to work out with a woman whose heart rate at comparable level of exertion would be be something 1.6 times my heart rate. I'd be hanging out at around 120, she'd be up above 190. No problem for her, but a great indication that things like "heart rate ranges" and "220 minus your age" don't work well with the whole population, and may be pretty bad for specific individuals.
As you may already know, increase in stroke volume is one of the primary adaptations from training.
This is a combination concert preview/review, so it will all fit in one post. But first, a few comments on the incorrect choices:
The winner is my friend Nick, who picked Green Day. I may be old, but I'm not dead yet, and Billie Joe is only 8 years younger than I am. Oh, and the opening act is Jimmy Eat World, and they're sooo cute, and they do that song, "The Middle", right, that's soooo cool. Our 11-year-old daughter isn't happy that she doesn't get to go with us, but at 11, she's a few years too young for a Green Day concert yet.
I went and looked at the Tacoma Dome information site today to see when the doors open, and it said:
"Parent's room will be available in the Exhibition Hall starting at 6:30pm."
Unfortunately, my parent's won't be able to make it, as they're both in their 70's, but I appreciate the gesture.
Oh, and for trivia buffs, the last concert we went to was Rush on the Roll The Bones tour.
So, enough of the preview. On to the concert....
Well, it's the morning after. I'm not going to write a detailed review, both because I'm lazy and because it will either bore people or annoy them (strangely, *not* doing that goes against two pillars of my blog writing creed - "To Inform, Bore, and Annoy").
So, here are a few random thoughts:
Jimmy Eat World played for about 45 minutes. Green Day played for two hours without any real break (though I guess you can rest a bit while you're lying on the stage, even if you do have to keep singing harmony...) Production values were professional, stage show was great. In other words, it, well, "rocked", which I guess is what you want in a show. Definitely recommended.
Last night, when I got home, my wife asked me if I'd read Eldon's blog. A quick look showed that he was trash talking about today's ride. Me, I don't need to trash talk or work to psych anybody out, because I'm confident in my climbing skills. So confident, in fact, that I thought I was a virtual lock to make it to the top of the hill, and even pick up some time over my previous ascent.
Despite the fact that I run BicycleClimbs.com, and unlike Eldon, I'm not a particularly gifted climber. I'm learning how to suffer (more on that later), but my physique is not suited to be first up the hill.
The sport of bicycling has lot of variables. Wind and aerodynamics play a huge part, as does drafting. But when you get to the steep hills - unless you're talented to ride up them at meaningful speeds - it's mostly about power/weight ratio. I was thinking about this a few days ago, and dusted off some disused physics expertise.
First, we need to figure out my potential energy at the top of the hill. For that, we'll use the following formula:
PE (Joules) = mgh
My bike and I weigh pretty close to 200 pounds (a few pounds less, but that doesn't matter) = 200 / 2.204 kg = 91 kg. That's the m.Zoo hill is 1200 feet = 1200 * 12 inches = 1200 * 12 / 39.3 meters = 366 meters. That's the h.Finally, g stands for gravity, and for the earth, it's 9.81 m/sec^2
So, that gives me:
PE = 91 * 9.81 * 366 = 330000 Joules (if I mess up on the significant digits, my wife will kill me.)
All that is left is to convert that to Watts. Conveniently, 1 Watt = 1 Joule / sec. I climb the zoo in 25:30, so
Climbing Power = 330000 / 1530 = 220 Watts
There's some additional sources of resistance, but they probably aren't that big for the Zoo, especially at the speeds I ride.
Eldon wrote that he did the Zoo last week in about 21 minutes (lets say 21:30). That's a ratio of 0.84 to my time. To match that, I either need to up my power output to 220 / 0.84 = 262 watts, or I need to reduce my weight by the same factor to 180 * 0.84 = 151.2. I did weigh that much in high school, but I had less upper body muscle than I do now (hard to believe, I know).
So, class, what did I prove? Well, I proved that there was no way I was going to beat Eldon. But maybe there was another way. For the climb, I wrote up a few guidelines and printed them out, along with a map. Here's what they said:
I then handed Eldon a sheet and asked him to read them out loud, with the excuse that I didn't want him to be the only guy who got to be funny.
What he didn't know was that his sheet was special. All the other ones had an additional guideline which said:
Yes, if I can't beat Eldon myself, perhaps I can pay somebody to do it. Eldon claims that that is evil. Hmm. What did I read yesterday? Oh, yeah, "I will pay other people to interfere with my boss's boss". Yeah.
So, anyway, we did the ride, and I displayed my mad climbing skillz. I bumped my average heart rate up about 5 points, and got up in a time virtually indistinguishable from last time. And I wasn't last to the top, though I should note that of the two guys arriving after me, one started 10 minutes behind me, and the second was about 5" taller than I am.
But I am learning to suffer better.
In the next 3 months, I'll be going to a concert. Since the period since I last attended a concert can be measured in decades, this is a big event.
I will likely be subjecting you to a review in the near future ("though the first 3 songs were full of energy, the drumming in the second set was almost pedestrian in its tempo..."), which I expect you will delete immediately. In fact, I will preface the title of the review with "delete this post:" to make it easier for you.
But enough of that. Who would pull me out of my decades-old retirement?
Please put your guesses in comments. A free souvenier program to the first person who guesses correctly. Oh, and no fair posting and ruining it for everybody if I happen to have told you already.
One of my readers suggested a group ride of the Zoo, so I'm teaming up with the Phat Psyklist to put on the:
The Double-E half-hour of Pain (You do Zoo, We do Too)
September 24th, 2:30 PM at the base of the hill. Eldon said something about cake at the summit. If you want to participate, please send email or leave a comment so we have some idea how many people are showing up.
This is not a climb to be approached lightly. Proper preparation includes a well-maintained bike, good legs, a sufficient arsenal of excuses, and willingness to explore the outer limits of performance and whining.
Notes for first time zoo climbers:
Sunday, I went on what will likely be my last organized ride for this year (regular readers are rejoicing right now).
Unlike some of the other rides I've done, this ride has a theme. As noted on the details page, this ride is based loosely on the salmon spawning cycle. You start next to Puget Sound in Myrtle Edwards Park (also hosting a "miles of fence and lots of big construction equipment" event at the same time), travel upstream to the Locks. That's the "Chum run", clocking in at 14 miles. Next up is the "Fit for a King" (as in "King Salmon") loop at 33 miles, where you ride to Seward parks on Lake Washington, on to the locks, and then out to Puget sound, recreating the trip that a young salmon would take on its first journey to the sea.
New this year is the "Copper River Special" (named after seafood company in Alaska). This loop takes you around to West Seattle to Alki point, which is important to the salmon because it's 11 miles in length (fun history fact - the Denny party landed at Alki Point in West Seattle in 1851. Arthur Denny, in a move to make his mark on the city, later named one of Seattle's most prominent hills after himself. Disgruntled townfolk had it removed, and Arthur went on to found a hugely successfully 24-hour dining chain).
The copper river loop started at 44 miles on the website, morphed to 50 miles on the maps, and turned out to be 53 miles covering some of the worst pavement to be found in Seattle.
After winding along the picturesque Seattle waterfront parallel to the picturesque Alaskan Way viaduct (*that's* why it's "Copper river"!) (acting as a semi-permanent eyesore along Seattle's waterfront), we headed across the bridge to West Seattle. I hooked up with a racer and his ex-racer friend (both wearing local team colors) for the trip around Alki, which was fast, bumpy, and a bit wimpy. We then headed back to downtown, up the hill, through the I-90 bike tunnel , and then down to Seward Park, the first food stop.
Following the "spawning cycle" theme, I had worked really hard getting from Puget Sound to Lake Washington, and then died after getting there. Unsure whether salmon get dehydrated, I decided to cover that front "just in case".
In a rare nod to non-motorized transportation, the city of Seattle closes portions of Lake Washington Blvd for Bicycle Saturday and Sundays. Flat road, great scenery, no cars.
After skirting around Capital Hill (known for... well, you can search yourself if you want to know what it's known for), the ride joined the Burke-Gilman trail, and led to Gas Works Parks, which has peerless views of downtown Seattle (over Lake Union), and some big ole' rusty industrial equipment left over from when it's use as a coal gassification plant.
At this point, things get a little hazy, but I managed to make it to the next food stop at the aforementioned Locks. I had reached the "just get this done" phase, and after a short rest, I headed out and up the steepest hills of the ride into Discovery park. There used to be a Navy base there, and it's very eerie to ride through overgrown roads and tall fields of grass, with the occaisional perfectly painted and maintained structure in the middle of a field. Weird.
After finding our way out (markings were a bit vague), we headed on Magnolia Blvd, and then back along the trail to the starting point.
And therein lies the rub. To avoid the killer climb, the 14 mile loop goes the other direction on that same route, which means you have a mix of fast and slow riders going one direction and slow to very slow riders going the other direction. At one point there's a small curved bridge. There were people walking their bikes, so I followed a slow group on the left, which ran into a group of walkers coming the other way and walkers trying to remount at the top. I decided to add to the confusion by getting off balance and falling off my bike, which sort of punctuated the experience. In my mind, it's unacceptable for Cascade to let that sort of thing happen - if you're going to use that route, you have to have people on both side make sure everybody dismounts for that bridge.
After my horizontal excursion, I headed back to the park for the end of the ride.
Rant #2 - why is finish line food so bad for you? I mean, I don't mind a little indulgence, but when the only thing you can get is a burger on a white bread bun or some suspicious salmon (ah, the salmon theme again), it's not the best of all worlds.
Recommended? Well, I don't know. It's bumpy, could be windy, and you have lots of inexperienced cyclists to watch out for (worse than Flying Wheels).
I've always been interested in puzzle games, and I spent a fair amount of time on "The Incredible Machine" series.
Professor Fizzwizzle is another entry in that same genre. Freeware demo.
(Writers note: I apologize for this C#-related post. I'll return to posting trivial and useless information, reviews, and links soon)
A post on one of our internal groups came up asking whether a class's implementation should use properties on that class, or whether it should restricted to fields. There was a bit of discussion, with some replying "sure", and others saying that you should always use properties.
Here's my take on it. The discussion is about a class that implements lazy loading of a bitmap property named "Bmp".
Came up with this one tonight.
Pea Salad with Chicken and Prosciutto
Put peas into a bowl, and cover with hot water (I use the 190 degree water from my dispenser). Set aside.
Cut chicken breast into 1/2" pieces, put on a plate. Liberally salt and mix so that all sides are seasoned (I prefer kosher salt for this). This draws some juice out of the chicken which carmelizes when you cook it. Set aside.
Fry Prosciutto slices until slightly brown on both sides (this lets you slice it without it sticking together). Remove from heat, and slice into small pieces about 1/4" square. Put into a large bowl.
Slice tomato, pit and chop olives, and slice up basil leaves (a chiffonade works well for the basil). Add to the bowl.
Drain peas, add to the bowl with about a tablespoon of dressing (more if you want more).
Reheat nonstick frying pan you used for prosciutto. When it's hot but not smoking hot, add chicken and distribute to cover pan. Do not stir - let it sit for a couple of minutes to brown. Toss the chicken every minute or so after until all of it is cooken through (chop through a couple of the large pieces with a wooden spatula to be sure it's done). Remove 12 small pieces for your daughter who doesn't like the salad. Add chicken to the salad, mix thoroughly, season more if necessary, and serve.
Makes something like 3 servings for a main dish salad.
With a final bit of effort over the last weekend, I got my HDTV system up and running, and I thought I'd spend some time talking about some of the questions that I had to answer along the way.
Should I get HDTV?
There are a few questions you should ask yourself:
If either of these are true, you're a good candidate to get an HDTV-capable display. Contact your mortgage provider and/or landlord and see how they feel about you skipping a few payments to fund your display.
Is the show that I want broadcast in HDTV?
No.
What is the difference between 480i, 480p, 720p, 1080i, 1080p, and 3000GT?
Those are different HDTV formats. When companies first started getting together to talk about HDTV, they all wanted support for different formats, and rather than decide on one, they agreed that the standard would encompass some 20-some different video formats, which have mostly shaken out into the ones I list.
The base format - at least in the US - is 480i, which is what Americans call "TV". The 480 refers to the number of horizontal lines that make up the picture, and the "i" means interlaced, which is a "term of the art" that means that all odd lines are drawn, then all even lines. Interlacing is used because it's cheaper, though there are many disadvantages.
The "p" in 480p means progressive, which means that it's not interlaced - scan lines are drawn from top to bottom, one after the other.
And so on for the other formats. As the numbers get higher, the picture quality increases, as does the number of house payments you need to skip to afford it (in some cases, you may have to buy a more expensive house to be able to skip a sufficient amount of payments).
These days, you want a display that does at least 720p and 1080i.
The 3000GT is a 1990s vintage Grand Touring Sports Car from Mitsubishi.
What's this 4 by 3 and 16 by 9 I keep hearing about?
These are aspect ratios. (I'm sorry if you thought it had something to do with Seven of Nine (I'm even sorrier that I wrote that))
Aspect ratios are determined by dividing the width of an image (be it picture or video) by the height of the video. Standard TV is 4:3 (1.3333 etc), and "wide screen" (which may or may not be HD) is 16:9 (1.77etc). The goal of having a 16:9 aspect ratio is so that movies can be appreciated as their director's intended them to be appreciated, or some such rot.
A noble goal, and there are some movies filmed at 16:9. There are also some filmed at 5:3 (0.613 e), and a whole bunch filmed in widescreen, at 47:20 (0.748 pi), or even 8:3. And a whole bunch of aspect ratios in between. So, until we perfect the squeezable monitor, you won't see exactly what the director intended, but a 16:9 screen gets you closer on most movies.
What does the "HDTV" entry in the program guide mean?
Little or nothing. It means that the broadcaster is promising that you're getting HDTV, but since there is no mention of intraocular impalement, it's hard to take them seriously.
The signal is pretty sure to be HD, but the source content might be shot in a variety of formats. Perhaps the producers spent the money to get the latest of Sony's offerings. Or perhaps they had to economize a bit. It might be true 16:9 content, or it might be 4:3. Similarly with commercials - some will look great, some not so good.
What provider should I get?
There are three basic ways to get HDTV content. If you are lucky, one will work for you. If you are very lucky, more than one of these may work for you.
What hardware should I buy?
Well, that's hard to answer. In my book, having a decent PVR (/DVR (/Tivo)) is about 10 times more important (more precisely, it's 9.87663 times more important) than seeing things in HD, so I would only go with a HD solution that has a good PVR with it. There are HD-only receivers that either do SAT or OTA if you want to go that route.
If I get an antenna, how should I mount it?
You should mount the antenna is cheaply and easily as possible while still getting the signal you need. In my case, that meant an eave mount at one end of my house, but there are lots of other choices. It would be a good idea to read the ChannelMaster installation guide to get some more information.
[Update: Go read Todd's comments - he added a lot of great information]
Now for sale.
Space Monkey Pants would be a great name for a band...
from BoingBoing
Yesterday, the C# team (among others) announced Linq and C# 3.0, and put up a great page of information. I haven't had a chance to look at things in detail to see how much they've changed since the last time I saw them in detail (about this time last year), but I do have a few things I'd like to comment on.
On first look, Linq looks great. I'm really happy at what you'll be able to do, and I think the language changes aren't too intrusive. Having spent some time recently writing a bunch of tedious DB stuff for a side project, Linq will really make things easier.
On the language side, there are a few cool enhancements.
The first is implicitly typed variables. This seems a bit out of place in a language like C#, but perhaps an example will better demonstrate why they're there. This is one of the Linq examples:
List products = GetProductList(); var productInfos = from p in products select new {p.ProductName, p.Category, Price = p.UnitPrice};
In this example, we're trying to select out 3 columns from the products table. The problem we have is that productInfos will end up being a List<X>, but there's no name for X - it's a compiler-generated type that has the three columns as members. One option is to require somebody to define a type with fields ProductName, Category, and Price in it, but that's tedious busywork at best. A second option is to require the user to name the type at some point in the "from" clause. After a fair bit of discussion, the design team decided that the best option was to add a "var" construct, where you can declare an instance of a variable without specifying a type name in it.
The use of "var" is not limited to Linq queries.
The second addition is something known as an extension method. Say that you're writing a new web-based game, and you need a way to convert from standard English to Leet Speak. You would like to be able to add a method to the string class, but because String is sealed (for some very good reasons), you can't. What you end up doing is writing a static method and calling it, but it's not very seamless.
With extension methods, you can write the following:
public static class StringExtensions{ public static string MakeLeet(this string source) { // return the Leet string here... }}You then write:string s = "I have found the programming features of C# 3.0 to be most envigorating";string leet = s.MakeLeet();Console.WriteLine(leet);
and you get the following as output:
y0 d00d, C# 3.0 rox0rz, w00t!!!!!!!!!!!!
The other additions - lambda expressions et al are there to support the linq work, and I know enough not to try to cover something like Lambda expressions in a short note. (or perhaps even a long note). But if you're a master of the BNF, take a look at this.
The year was 1979. Or maybe it was 1980. I'd been programming for a couple of years, but didn't have my own computer. *Nobody* had their own computer. But I did have enough for a magazine subscription.
There were only a few serious choices. BYTE was one choice, but it was - even in those years - not terribly exciting. Another option would have been Dr Dobbs (Full Name - "Dr Dobbs Journal of Computer Calisthenics and Orthodontia"), if I'd know that it existed.
The third option was a publication known as "Creative Computing". IIRC, I forked out the princely sum of $15.98 for a two year subscription, and never regretted it. Creative had a unique mix of information, entertainment, and irreverence. I kept a few articles over the years, but the majority were tossed out.
Today I came across an archive of computer books of the late 70's and early 80's at AtariArchives.org, and among those are 3 "Best of" volumes from Creative Computing.
If you've been waiting for a good ASCII art version of Snoopy and Charlie Brown, you can find one. Or, if you need a review of Wumpus 2, you're in luck.
Now, help grandad back to his rocking chair, will you?
God Tower
I'm on level 2.
Update: Okay, a bit more data.
The puzzle is really to figure out what the puzzle is. Once you do that, a few jumps will get you to the answer, which is entered in the password field, in all-lowercase without any spaces.
I might give more of a hint on the first level if lots of people get stuck.
Update 2: Now on level 10. These remind me a bunch of the kind of puzzles that get used at the Microsoft PuzzleHunt. You get something, and then you have to figure out how data is encoded in it. Some of them are very easy, some are hard.
Apparently, the author is Thai.
This is wrong on So Many Levels...
From PCL LinkBlog
It's a not-well-kept-but-not-overly-publicized "secret" that many Microsoft products groups have advisory groups (named "focus groups", "customer councils", or something like that...) that help them with future product direction. I had the pleasure of working with the C# one for a couple of years, and their input proved invaluable in helping us set our future product direction.
Membership in these groups is obviously limited, but if you're going to PDC (I'm not...), you may be able to participate in a focus group that helps set future direction (I'm deliberately being vague because I don't own or really know the details here).
Leeches USA, LTD
In all honesty, the results that they get with leeches are pretty amazing. Case study photos are not for the squeemish.