Archive for category Technology

Code Review and the King James Bible

I am a big fan of code review! Whether the software is written in Java, C++, Python, or (shudder!) Fortran, code review serves a number of important purposes in an organization that develops software. When I worked at Smarttalk.com we used a system of code review designed to produce high-quality code quickly. Here were the steps:

  1. When a developer thinks he/she is done with a single code module (one source code file), that developer calls for a code review. The broadcast e-mail and meeting invitation must go out no less than 48 hours before the scheduled review, so the other developers have at least 48 hours to look over the code before the meeting. You can schedule a code review for 3:00 pm on Thursday as long as you click on the Send button by 2:59 pm on Tuesday (and there were a few of those).
  2. The software developer can invite anyone they want to the review, but at least one participant must be at the Senior level. Go ahead and invite your friends! There was some worry about people only inviting people who would be favorable to them, but we quickly learned this principle: Friends don’t let friends write bad software. You are more likely to accept constructive criticism from your friends than from people you don’t get along with.
  3. A quorum is three people: the developer and two other software engineers, one of whom must be at the Senior level. The code review works better with about 4-5 people.
  4. The code file to review must be less than 1,000 lines long. Generally the other developers retrieve the code from the repository.
  5. The meeting will not last longer than 1 hour. If the code review runs overtime, the participants adjourn and re-schedule.
  6. The goal of the code review is to improve the code. All our jobs depend on producing and marketing high-quality software, and it is in everyone’s best interest for the code in the repository to work well and be easily maintained.
  7. Everyone is nervous at first about their work being reviewed, and for this reason there is a Moderator. The moderator makes sure everyone stays on track, watches out for criticism that is not helpful, and ensures that the experience is professionally positive for the developer. The moderator has the power to kick someone out of the meeting if they are being arrogant or derogatory. I never saw that happen, though – usually it is enough to remind someone that the goal of the code review is to improve the code.
  8. Everyone at the review sits around a table with a listing in front of them. The listing is printed with line numbers for easy reference. The developer begins with a brief explanation of the purpose of the code.
  9. The developer leads everyone else through the code, page by page, or subroutine by subroutine. Everything is fair game for improvement. The reviewers speak up in they have comments on a certain section. If not, the review moves on.
  10. It is great for less experienced programmers to attend! They can learn a lot from someone else’s code. Often they make very worthwhile contributions by requesting more extensive comments for some algorithm that is not clear. Sometimes you get people who just watch out for uniform spacing or lines longer than 80 characters. Those people contribute something positive to the process.
  11. Everyone looks for adherence to the coding standards.
  12. Sometimes design flaws are caught in a code review. The script has to sanitize input for web security. The code has to handle Unicode characters. Sometime a subroutine is just too long!
  13. Reviewers can suggest tests that might produce a failure, if they suspect a bug. The developer makes a note of those and will verify later that the software operates correctly, or fixes the bug if it does not.
  14. If extensive changes are requested, then another code review will be scheduled when the first round of changes are complete. This is rare. Even if there are lots of comments, usually the revisions take only a few days to complete.
  15. After the review: When the developer completes the requested changes to the software, he/she adds a note to the header comments of the file saying that the code was reviewed on that particular date by the following people (full names). Then the developer may check in the code, and move on to another file.

The developer under review gets completed feedback in 49 hours. I’m sure our loyal Funmurphys readers can add to this process and improve it. Tweak it for your organization. Remember that the primary purpose of code review is to improve the code. A secondary purpose is to provide on-the-job training for the more junior programmers. From time to time people will see a clever way of doing something, or suggest one, and notice code overlap that can be eliminated.

Those should be reasons enough for any professional software developer to conduct code reviews. But suppose you are out there thinking, “I’m a good engineer! I’ve written code for years, it’s well tested, and there are only a few minor bugs in my work. I’m good! I don’t need code review. It’s just a waste of my time.” Yeah, you’re kind of arrogant, but you have a right to be.

Here’s why you should request and schedule code reviews on your own code. Because someday, when you least expect it, someone else will come along and have to maintain or extend your code. And yeah, they won’t be as smart as you. They won’t understand your brilliance. They won’t take the time to read through your code and figure out how it’s carefully designed to work. What they will do is go to your boss and say the following: “This code that YourName wrote is dog poop! (but they won’t say ‘poop’)! I can’t follow it at all. This code has to be completely re-written!”

Then your boss will be faced with a dilemma. She knows you are a good software engineer and you write good code. She has not heard any problems with your code until now. But the new person is so insistent that your code is dog poop, that it has to be thrown out and re-written from scratch, and the new person uses lots of CAPITAL LETTERS and exclamation marks and derogatory language in his e-mail complaint. I have seen this happen. What should your boss do?

Your boss has to evaluate the complaint. Your boss has to examine the code you wrote with a fine-toothed comb, checking if you are correct or if the new guy has some validity to what he says. Your boss has to call a technical review at which your detractor will be the star witness. You can’t defend yourself very well since you have moved on to another part of the project. You’re under suspicion. Unless . . .

Unless there is a short section in the header saying the following: This code was reviewed on March 28, 2010 by the following people: Ashley Adams, Bob Biltmore, Charlie Chang, and Debbie Dumas. When your boss finds that comment in the code, her course of action is simple: “Sorry, Mr. New Guy, but this code was reviewed by the software development team and found to be acceptable. You can suggest some improvements, but we are not throwing it out and re-writing the whole thing from scratch. If you cannot understand some else’s code, we will send you back into circulation and hire someone who can.”

Yes, code reviews can be held to Cover Your Anatomy. It’s not a great reason to do them. If the good reasons above are not sufficient to urge you to do code reviews, perhaps this bad one will. Enough said.

Now let’s turn back the clock 400 years to post-Elizabethan England, during the reign of King James I. He decided to produce a new translation of the Bible, the Authorized Version that would bear his name. Alister McGrath has written a great book about this period, which you should stop reading this blog to go out and buy, then come back here. The book is “In the Beginning: The Story of the King James Bible and How it Changed a Nation, a Language, and a Culture” (2001). The translators worked in teams. On page 187 we read this account of the actual translation process:

The translation in King James’ time took an excellent way. That part of the Bible was given to him who was most excellent in such a tongue (as the Apocrypha to Andrew Downes), and then they met together, and one read the translation, the rest holding in their hands some Bible, either of the learned tongues, or French, Spanish, Italian, etc. If they found any fault, they spoke up; if not, he read on.

When I read this excerpt I laughed out loud. These guys are doing a code review! They used the same process 400 years ago to produce a good translation of the Bible that we use in modern times to produce good software! They all sat around a table and checked up on each other’s work. When the King James translators found a discrepancy, they worked together to resolve the problem That’s just what we do, too! I am sure that nobody at Smarttalk or any other software company set out to emulate the King James Bible scholars. But we have hit on the same process to produce a high-quality product.

This does not mean that the King James Bible is a perfect translation; the McGrath book documents a few errors that were corrected later. Another example is Hebrews 11:3 in the King James Version, which reads as follows: “Through faith we understand that the worlds were framed by the word of God, so that things which are seen were not made of things which do appear.” But the Greek word used for ‘worlds’ there is Aion (Strong’s Concordance G165), and should be translated into English as ‘eons’ or ‘ages’. God’s word of command caused huge spans of time to come to pass, as well as physical worlds. The KJV is not perfect. Nevertheless, if people are still using my code 400 years from now, my descendants should be very proud!

Maybe someday I will compare and contrast the process of code review with the peer review conducted by scientific journals.

Tags: , , , , , , , ,

Remembering Y2K

Happy New Year’s Eve!
Happy Last Day of December!
Happy Last Day of 2009!
Happy Last Day of the 2000s decade!

Ten years ago today I was working from home, since I was an independent software developer back then. This was The Day that the dreaded Y2K bug was supposed to hit. The End Of Civilization As We Know It, or just TEOCAWKI for short. Remember?

A number of social commentators were predicting that the Y2K computer bug would cause large-scale failures in our computer-based infrastructure, including some Christian conservatives like Michael Hyatt and Chuck Missler. Ed Yourdon predicted that computer systems administrators would head to the hills en masse because they realized that the problem was huge and couldn’t be fixed. My local hardware store carried large electrical generators with signs saying: “Don’t even think of returning this on January 5 if Y2K turns out to be a bust! We’re onto you.” There were tales of survivalists cashing out their retirement accounts, buying a ranch in the mountains, stockpiling guns and ammo, taking their wives and children up to the compound after Christmas, and keeping a loaded gunsight out for looters when the millennium sun peeked over the horizon. Even modern cars weren’t supposed to work. Remember all that?

As a software engineer, I issued my own prediction in March 1999: Y2K will be no worse than a hurricane. Power and basic utilities will be restored within 48 hours. You’ll be able to go back to work in a week. My prediction seemed pretty mild at the time.

I had a plan, too. I stockpiled about one week’s worth of food, water, and firewood for the “hurricane”, taking care to be sure that anything I bought could be used later for camping trips if Y2K fizzled out. Partly it made good sense to be prepared, partly I was fascinated by the social aspects of worried people getting ready for TEOCAWKI, and partly I wanted to reassure those around me. I still have some extra jugs of drinking water and a few packs of candles and lighters left over. All the Ramen noodles and beef jerky are long gone.

During the summer and early fall I received lots of letters from my bank, my insurance company, my utilities, my retirement company, my post office, all declaring that they had been certified as “Y2K Compliant”. Then in November I got a letter from the supplier of my diskette mailers, saying that they were certified as Y2K Compliant and that the supply of diskette mailers would be uninterrupted by the dawn of the new millennium. I just stared at the letter. Diskette mailers. It’s come to this, probably the most trivial and non-essential item that I purchase. That’s when it hit me that Y2K was gonna be a big bust. The alarmists were wrong. Everything’s going to be all right.

New Year’s Eve fell on a Friday that year, leaving an entire weekend for the computer people to fix whatever problems they found. Ed Yourdon was wrong – the computer system administrators (my friends and colleagues) behaved like the responsible professionals they are, working all that weekend to run tests, re-boot machines, and examine diagnostics for signs of any technical Y2K problems. The weather in Colorado was unusually warm.

I filled up all the bathtubs in my house with drinking water. I remember thinking, “Why should I do this? It’s just a waste of water. Nothing bad is going to happen.” But filling up the bathtubs was Part Of The Plan, so I did it anyway. That evening I discovered that the drains in my tubs didn’t seal very well, and I had lost about half my supply already. The best-laid plans . . .

Since I was working from home, I could keep an eye on the TV. Midnight and the Millennium Dawn were sweeping around the globe. The celebrations were wonderful to watch! In Australia they had trapeze dancers swinging from ropes affixed to the top of the Sydney Opera House. Japan had marvelous dancers and costumed performers. China had spectacular fireworks! Then came Thailand, India, and celebrations in Africa. A few minor problems were reported, like weather maps that displayed the year 19100 and some video rental fees not calculated correctly. But everything was coming out fine, even in Italy who had not done much to prepare. I just relaxed, let all the technical concerns slip away, and watched in wonder as the happy festivals spread around the globe with the coming sunshine. Wow!

Praise God! Happy New Year!

Academic and Choral Achievement

Here is an update since Kevin updated the blogging software. In May 2009 I graduated from the University of Colorado at Boulder with a Master’s degree in Atmospheric and Oceanic Sciences. Wow, five years is a long time! There were quite a few speeches during the graduation ceremony, but I didn’t mind a bit! It took a lot of work to get to that ceremony, and I just sat there in the sunshine with my Master’s robe and mortarboard cap and drank it all in. John Roberts (a CNN correspondent) gave an inspiring address about making your dreams come true. When you come up against a wall, this is your opportunity to show the world how much you want something. If you want your goal bad enough, you will go over, under, around, or through the wall to reach your goal! I feel that I have so much potential, and opportunity, and rich possibilities ahead of me. I don’t ever want to lose that feeling. My sister and family came to see the graduation. Maybe someday when my kids get frustrated with school and homework and term papers and exams they will remember the bagpipes and the funny academic gowns and their Daddy graduating and they will understand that it’s all worthwhile.

Kevin, I don’t know if you wrote a thesis when you got your Master’s degree from Stanford University, or if the co-terminal program had some other option. I wrote a 110-page thesis describing my research and model results:

Title: Application of Storm Surge Modeling to Moses’ Crossing of the Red Sea; and to Manila Bay, the Philippines

Abstract:
Storm surge occurs in low-lying coastal areas when strong winds blow the sea surface up onto the land. The resulting inundation can pose a great danger to lives and property. This study uses an Ocean General Circulation Model and the results from a mesoscale atmospheric model to simulate storm surge and wind setdown. Two case studies are presented. A reconstruction of the crossing of the Red Sea by Moses and the Israelites, as described in Exodus 14, shows that the eastern Nile delta of Egypt matches the Biblical narrative and provides a hydrodynamic mechanism for water to remain on both sides of the dry passage. The vulnerability of Manila Bay and the surrounding areas to a Category 3 typhoon is evaluated and shows that the simulated surge heights depend heavily on the wind direction and the coastal topography.

The thesis document is published electronically by ProQuest, and anyone can download the PDF for a fee and read it. I classified the thesis under Biblical studies in addition to Physical oceanography and Atmospheric sciences. It would be cool to hear a little bell every time someone reads my thesis, but scientific publishing has not reached that stage yet.

I also made the national news for having sung in the Boulder Messiah Sing-Along for 17 consecutive years now. On November 3, 2009 the Associated Press published a news story on Messiah Sing-Along events, featuring the Boulder Messiah Chorale and Orchestra. Hallelujah for Handel’s ‘Messiah’ is by reporter Ann Levin. I am the Enthusiastic Choir Member in the story. If that link ever ceases to work, you can Google for: “Carl Drews” Messiah. Nobody has recognized me on the street yet (“Hey, you’re that Messiah choir dude!”), but it is nice to see that our sound is gone out into all lands, at least electronically.

Tags: , , , , ,

Endlessly Re-Booting Laptop

Endlessly Rebootiing
Laptop Can’t Find Starting Point
Life and Work on Hold

That was Friday’s high tech haiku. New disk installed Saturday and I have been recovering data from backups and re-installing applications from CD-ROM (here’s a tip, always get the CD backup for an application, that saves you from having to buy it again).

Tags: ,

The man of the hour has an air of great power

I wrote this last May in draft form and have finally gotten around to finishing it. How quickly the conventional wisdom changes, now everyone knows we are in a recession. Of course you should “raise as much money as you can, enough to last you for a few years until the recession is over” is also part of the conventional wisdom. As my Uncle John would have observed: it’s generally accepted, so generally accepted it may not be true at all.”

May 9, 2007: Report from Silicon Valley

So we are starting to pump a little hot air back into the bubble every week now. The streets of Silicon Valley witness young entrepreneurs looking for department store Santas venture capitalists to listen to their list of needs and make their dreams come true. It’s “not as nuts as 99″ but not as sane, or dour, as 2003. Roger Macnamee blogged for the better part of 2004 on “The New Normal” with this as his inaugural post:

Wake up and smell the coffee. This is not your father’s economy. And it’s not the boom that inflated our expectations and then exploded. But it’s also not the doom and gloom we’ve been mired in for nearly three years now! So, wake up. Pull yourself together. Get on with it. With what you ask? With the rest of your life. It’s a bright, fresh world full of opportunities. I know that runs counter to many of the opinions all around us, but it’s true, and I can show you why. It’s true for the investor, the entrepreneur, the CEO, the unemployed, and the human being seeking balance. This blog will be dedicated to insights and discussion about life, business, and investment in what I call The New Normal.
Please join in!

Now I regularly have conversations that remind me of 1997-2000. I am routinely admonished that “the old rules no longer apply” and advised that successful firms spend much of their treasure on PR social media and viral marketing (regular marketing is a waste of money since viral marketing is free). YouTube’s 1.6 billion dollar exit is the exemplar burned in 10 mile high neon letters into the back of everyone’s retinas.

This is not a lament nor a longing for the early 90’s (or early 80’s), now is the best time to be alive and an entrepreneur. It’s a wish that more firms would aim for creating value for their customers.

National Engineers Week

It’s National Engineers Week! Break out the party hats!

Seriously, there are few professions where you can have the same mix of challange, fun, renumeration, and impact on the world as you can with engineering. And women, you should consider a career in engineering.

Alcohol Powered Fuel Cells

What can run longer than the energizer bunny? Fuel cells powered by vodka and enzymes, if you can keep the enzymes around long enough. A St. Louis company is working that very problem, and hopes to one day make fuel cells that run for a month before you fill them back up:

Akermin, however, has developed a polymer membrane that is used to contain the enzymes and prevent them from breaking down.The result is a lab-scale fuel cell that has continuously generated power for more than two years and is still running, said Nick Akers, Akermin’s president and co-founder.

It requires the alcohol supply to be continuously renewed.

The company has demonstrated other breakthroughs, he said:

“The enzymes are able to completely break down the alcohol, increasing efficiency and providing a longer run time from a given volume of fuel than other types of fuel cells. A pen-cap full of alcohol lasts about 30 days”, said co-founder Shelley Minteer, a chemistry professor at St. Louis University, in a radio interview last year.

It has engineered a commercial prototype that stacks several tiny fuel cells into a device like a battery pack that is rugged and about the size of a cell phone.

So far, the prototype is just approaching the amount of power generation sufficient to fuel a cell phone. Creating a device that could run a laptop computer is years away, Akers said.

The eventual goal is creating a small, powerful array of fuel cells that last a long time and can be instantly “recharged” by replacing a small, portable and non-toxic alcohol cartridge. Corn-based ethanol is a likely source of fuel because there is a ready supply, but the cells have been shown to run on vodka, gin and even flat beer.

No word on how long before devices that can power flying cars will be on the market.

So maybe the push into ethanol as a renewable energy source will pay off after all.

OK, I do think it’s really cool that they are doing this work right here in my hometown.

Tags: ,

Can’t Get Enough iPhone

iPhone is so monumental I can’t just leave it with one post.

First, I’ve made some nice paper gains on my Apple stock the last two days. Yes, this is gloating. See item 3.

Why did they have to exclusively partner with Cingular? Everybody I know who’s ever had Cingular has hated them. Not disliked, not been unhappy, HATED them. Couldn’t get off the plan fast enough.

How would you like to be Michael Dell? He gave the daily keynote speech at CES yesterday at the same time Steve Jobs was giving hisMacWorld keynote. Seen any coverage of that? Yeah, me neither. Almost ten years ago, when asked about Apple, he famously said “I’d shut it down and give the money back to the shareholders.” Yikes! That has to rank as some of the worst investment advice ever. Still, Mr. Dell is reportedly a lot easier to work for than Mr. Jobs. Oddly enough, so was Atilla the Hun.

Apple Computer is dead. The pundits who predicted it’s demise for so long are not rejoicing however, because Apple Inc. is alive and well. A rose by any other name would be just as sweet, but who am I to argue with Steve Jobs? Or Carl Howe of Blackfriars marketing who claims that Apple just changed consumer electronics nine ways. Maybe next year CES will change their dates so Mr. Jobs can speak there.

Brian Tiemann noticed that Apple dropped more than computer from the company name; Apple may have droped the Mac from Mac OS X now that it is the iPhone operating system as well and wonders if it should be pronounced “Oh Ess Ecks”? After Jobs made such a big deal about putting a phone, an iPod and an internet device into one seamless device, I predict they will rename Mac OS X as NXS and pronounce it “in excess”, that way they can combine a great operating system with a great rock band, INXS. It’s What You Need.

John Gruber says the iPhone screen is amazing: “166 DPI is an amazing resolution – tiny, tiny text is amazingly legible.” I’m guessing John isn’t over forty, because for people of a certain age tiny tiny text is not just illegible, its unnoticable. But after springing $600 dollars for the phone, I suppose I can spend $10 on a pair of reading glasses to go with it.

Tags: ,

The iPhones Are Here, The iPhones Are Here!

A lot of people make bold claims but few can back them up, but when Steve Jobs talks, people listen:

“Well, today, we’re introducing three revolutionary products of this class,” said Jobs. “The first one is a widescreen iPod with touch controls. The second is a revolutionary mobile phone. The third is a breakthrough Internet communications device.”"These are not three separate devices,” said Jobs. “This is one device. And we are calling it iPhone. Today Apple is going to reinvent the phone.”

No not everything turns out like the iPod (just don’t mention “Brain in a Beaker” or Newton to Steve), but Steve and Apple have been on a roll lately. I haven’t even seen the thing, and I want one. Of course, I’ve already drunk the Kool Aid, so what else would you expect?

Tags: ,

Month of Apple Bugs

I’m a big Mac fan, and so in the interest of equal time, fair and balanced, journalistic ethics, etc. etc. etc. here is a link to the The Month Of Apple Bugs blog. Here’s hoping they all get squashed.

UPDATE: Apparently there was a bug with the URL which has now been squashed.

Tags: