Crouching tiger, coding monkey

A memory leak in the alluvial dampers

Filed under: Programming — Grant July 22, 2008 @ 12:46 am

The last few days I’ve been spending some quality time with my friend Shark doing a lot of performance testing. I actually kind of like that sort of work. I also have a feeling I was dropped a lot as a child.

Anyhow, as I was running some scenarios I had a bit of an epiphany. In fact, the more I thought about it the more I was amazed that I hadn’t thought of this before.

C++ is the Millennium Falcon.

Remember that childhood head trauma bit? Seems fitting right about now doesn’t it. Let’s look at a comparison though.

Are they both fast?

  • C++: My Shark tests say so and people always ask if Java can be as fast as C++.
  • Falcon: It did make the Kessel Run in less than twelve parsecs after all.

Are they both ugly looking?

  • C++: It’s no Perl, but I wouldn’t expect it to win any beauty pageants soon.
  • Falcon: Wikipedia says it was inspired by a hamburger with an olive beside it. A hamburger.

Are they both powerful?

  • C++: Piles and piles and piles of C++ code run all over the world on about every platform imaginable.
  • Falcon: It blew up Death Star #2.

Note: I admit that blowing up Death Star #2 isn’t really as impressive as it sounds. The first Death Star mission was repeatedly labeled as suicide and was only successful because of the intervention of a quasi-religious miracle. The second one had what amounted to a four lane highway built in leading to the biggest “Don’t hit me here or I’ll explode” target since King Hippo.

That all being said, it was still a noteworthy accomplishment.

Do they both fail in spectacular ways at the worst possible time?

  • C++: It’s author has said, “In C++ it’s harder to shoot yourself in the foot, but when you do, you blow off your whole leg.”
  • Falcon: Routinely shuts down requiring a reboot by punching the doorframe.

Do they both have big, hairy, incomprehensible partners?

  • Falcon: Chewbacca the Wookie.
  • C++: The STL.

You have to admit, the similarities are pretty startling.

Oh, and Han shot first.

malloc Wii Fit

Filed under: Programming, Wii — Grant May 23, 2008 @ 12:48 pm

I knew I wanted to write a blog post today and I really had two choices.

1. Join in the debate over whether or not you need to know C in order to be a real programmer.

2. Talk about the Wii Fit

Lots of people are talking about choice number one. Well, perhaps talking isn’t the right word. Flaming? Fighting? Insulting one’s intellect? Yeah, any of those would do.

But we can bang that one out quick; here I’ll take a stand.

Do you know C? – Yep.

Have you programmed in C? – Double yep.

Have you programmed professionally in C? – Yes.

Would you do it again? – Wouldn’t be my first choice but sure why not?

Do you think programmers should know about pointers and memory management? – Couldn’t hurt them. Not that it makes it any fun though. Screwing that stuff up, and it always gets screwed up, results in errors in fun and terrible ways.

Ok, now that that is out of the way on to the Wii Fit. Thanks to the magic of Amazon pre-orders ours arrived yesterday morning. By the time I made it home from work my wife was actively playing the hula hoop game on the Bluetooth scale board thingie while my three and a half year old daughter was standing three feet to the side making hula hoop motions.

Somehow I think Mario Corp. has a winner here with the new to gaming/super casual gaming crowd.

(And what about the Wii Fit commercial with the woman busting out the Yoga? I’ll bet they sold an extra bazillion units on that alone.)

Now we ran through all the unlocked games and exercises last night, and I doubt that it will cause any kind of gastric bypass like results, but one thing does stand out. The silly thing is fun. Who would have figured, balancing on a couple of scales to roll a virtual ball on a virtual board through a virtual hole is in demand entertainment these days.

We’ll have to see how long it keeps our attention, but I suspect with a couple people in the same house playing it the novelty won’t wear off as fast. In fact, I’ll bet right now my high scores on the balance games are being mercilessly attacked while I am hard at work blogging, err, working.

Oh, and to complete the circle from earlier, like all games it’s probably written in C. So if being a real programmer means writing pseudo-exercise console games it looks like C is indeed required.

Well, it might also be C++, but that’s really just C with a compiler messages that read like you strangled a cat. ;-)

Space shuttles and higher quality without the junk food

Filed under: Programming, Space Shuttle — Grant May 1, 2008 @ 4:35 pm

Isn’t fun to be blamed for doing something wrong when writing code? Nothing quite like having QA, or even worse a customer, find some major issue with something you wrote. Writing software is a hugely personal thing; there is a tendency for developers to think of their code as reflection of themselves. So when a big screw up occurs, the stages, not go all Kübler-Ross on you, go kind of like this:

Denial: “That’s not my fault.”
Anger: “Why were you using it like that anyhow?!”
Bargaining: “Let me just do a quick a fix, you don’t need to write it up.”
Depression: “How could I do that? I don’t deserve to use a compiler.”
Acceptance: “Oops. I should fix that.”

The question for the day then is how do we make writing software less a reflection of self? Let’s take a look at how one place tackled this.

The classic example that comes to mind when talking about projects that need high quality software is space travel. And why not, it has all the traits of good storytelling. Massive amounts of money, it’s incredibly dangerous, and if one tiny thing goes wrong it becomes a huge news story.

See Orbiter, Mars.

There was an article from a while back that talked about the on-board shuttle group of the Lockheed Martin space division. It it gives us a not surprising peak into the development process of writing software for the space shuttle and the steps they take toward having extremely high quality. From the article:

“This software is bug-free. It is perfect, as perfect as human beings have achieved. Consider these stats : the last three versions of the program — each 420,000 lines long-had just one error each. The last 11 versions of this software had a total of 17 errors. Commercial programs of equivalent complexity would have 5,000 errors.”

It also mentions why the quality is so critical:

* Shuttle costs about $4 billion dollars
* Lives of astronauts
* The focus of a nation

“Bill Pate, who’s worked on the space flight software over the last 22 years, says the group understands the stakes: ‘If the software isn’t perfect, some of the people we go to meetings with might die.’ ”

Brings a whole new level of seriousness to it doesn’t it?

I read a fair number of developer focus message boards and a recurring theme is the desire for things that are standard issue in this group.

* Everyone has an office
* Strictly 8 to 5
* They are mostly adults with spouses, kids, and lives outside of work
* A single client with a single platform
* There are essentially infinitely deep pockets thanks to the US government

I’m sure if working conditions like this were posted on the same forums there would be a digital stampede of resumes flying in. There is a downside though. Many time developers try to sell what they do as being part art, but from this next list there doesn’t appear to be much painting or songwriting.

* Planning, planning, and then some more planning
* Mountains of designs and specs
* Everything is reviewed, reviewed, and then reviewed
* There is no creativity. There is one way to do everything.
* No more stacks of Mountain Dew and empty pizza boxes.

It has been my experience that these items are the bane of the normal developer. Heck, one could argue that an entire methodology of software development has been created to stay away from this stuff.

There’s a bunch of other really interesting things in the article but it is the final of their four key tenets that really stuck at out me, and the one that answers our question from earlier is:

“4. Don’t just fix the mistakes — fix whatever permitted the mistake in the first place.”

This is really critically important, the concept of blaming the process and not the person. As soon as developers start getting defensive is when things like code reviews and refactoring become toxic operations. The shuttle software is certainly an extreme case and requires a level rigor not even remotely close to most software development but I can’t help but imagine that the process improvement/blame business would be useful. Once everyone bought into it the whole thing might even be embraced and quality would go up too.

I don’t know, for the cost of less soda and pizza it might just be worth it.

Xcode 3 Tutorial Part 3: Writing a QuickLook plug-in

Filed under: Programming, Xcode — Grant February 4, 2008 @ 11:09 am

So I finally got around to uploading a new Xcode howto video. This time it is an example of how to write a custom QuickLook plug-in using Seapine’s SoloBug application.

You’ll also notice that this time I’m using Viddler instead of YouTube. Through my fighting with encoding/uploading I’ve found that Viddler has a much higher quality level when it comes to being able to actually read the text on a screencast. It also doesn’t have the “Your video must 10 minutes or shorter because if it is longer than that you simply must be uploading copyrighted content” restriction like YouTube.

That last bit is important when you go all the way through making a video only to notice that it runs around fifteen minutes. D’oh.

The most unscientific survey ever

Filed under: Programming — Grant February 13, 2007 @ 9:50 am

There are a number of good software blogs that I read but there are two that always catch my attention when I see an update scroll through on the RSS feed.

Steve Yegge from Google.

Wil Shipley from Delicious Monster.

They really can’t be more different professionally. Steve works at a mega giant software company while Wil is more or less a one man show who works from a coffee house. Where they are similar though is that they have no fear whatsoever to say anything, no matter how controversial.

Oh, and they are pretty darn funny too. Well, as funny as software guys can be.

Steve’s latest post about the “Next Big Language” did have a laugh out section. I’ll quote for those not wanting to read the whole thing…

Back when I was in the Navy, just out of boot camp, an otherwise entirely forgettable petty officer first class instructor of ours offered us, unasked and free of charge, his sage advice on how to pick up women at a bar: “Go ugly early.” With this declaration, he had made it clear that he and I thought rather differently about certain things in life. But I had to hand it to him: here was a man of conviction. He didn’t care what other people thought of him, or for that matter, what he thought of himself. He had defined his philosophy and he was sticking with it.

And in a sense, he taught me a valuable lesson, although it’s not the one he probably thought he was teaching me. I’ll pass it on to you, unasked and free of charge. If you want to spare yourself a lot of angst in deciding which programming language to use, then I recommend this simple rule: Go ugly early. C++ will go out with you in a heartbeat.

Tee hee hee.

*Sigh*

It’s funny because it’s true.

That then lead me to have a discussion with a couple of different people and we came up with a quick two question survey. I’d be curious to get everyone’s answers to it and rather than muck around with WordPress to get a little button widget thingie just leave your answers as a comment.

1. On a scale of one to five, with one being “Bjarne is the greatest human to have ever lived, well second greatest if you count the guy that invented the burrito” (i.e. I like it) and five being “It’s teh suck,” (i.e. I hate it) how would you rate how much you like C++?

2. What programming language would like to learn more about/use more?

I’ll even start it off.

Question 1: I’d say 3, although I have 4 type leanings.
Question 2: I find Ruby on Rails kind of interesting so I’ll probably go with that.

I’ve also never used Lisp and I hear its great but I’m a little worried it will end up like Guinness.

That’s going to require some explanation.

When I was in college I drank beer. A number of my friends were huge Guinness fans but try as I might to like it I simply hated it. Maybe there’s some weird chemical reaction between me and the beer or it’s some kind of cruel cosmic joke but I just can’t stand the stuff. I’m kinda concerned that I would take to Lisp the same way. (i.e. I’d find it so distasteful that I’d have a Perl chaser. Ugh. I know no good would come from that.)

So there we go, now answer away. It doesn’t hurt and we’ve sterilized the commenting section so the risk of infection is pretty low.

Automator: I’ve got the hammer, but I can’t find a nail

Filed under: Apple, Programming — Grant September 21, 2006 @ 8:59 am

One of the lesser talked about Apple applications that I’ve long been interested in is Automator. I first heard about it with the rest of the world in the WWDC 2004 keynote and I remember thinking something like, “That’s nice.”

Later on I happened to watch all the Macbreak videos with Leo Laporte and Apple’s Sal Soghoian to which my reaction was, “Wow. Now that is pretty cool.”

MacBreak 20: Automator Media Browser
Macbreak 14: Automator Photoblog
MacBreak 8: Automator Life Poster
MacBreak 03: Enter the Automatrix

Then, at this year’s WWDC I went to a couple of sessions on Automator and walked away thinking, “Sweet mother of Steve Jobs’ turtleneck, that is cool stuff.” (Alright, that may not have been *exactly* what I was thinking, but you get the point.)

Yesterday I found myself with a bit of a hole in the schedule so I sat down to see if I could rig up something in Automator that might be useful to the Seapine community. Here lies the problem.

I couldn’t think of anything to do with it.

It all worked as advertised, I had workflows that copied junk from one place to another and queried the system configuration into a text file. In the end, however, I had nothing that was going to change my life or anyone else’s for the better.

I thought about setting up my build process in Automator, but I already that automated. I looked into seeing if there was any way to integrate Surround SCM into Xcode with it but found no dice there as well. I even considered using it to query against TestTrack with SOAP to produce an RSS feed of newly entered defects but that felt like too much work for the time I had. (Plus it felt like a reach, like I’m gonna make this thing do something dagnabit.)

I’m sure at some point I’ll use it to package up a bunch of pictures or Quicktime movies of the kid to keep the grandparents off my back, but for the moment I’ll just take my hammer and wander the halls. A modern day John Henry if you will. Well, maybe not, but at least a Don Quixote who’s stopped by Home Depot.