Friday, December 25, 2009

Red Flags

During a recent interview, the hiring manager handed me a book called The Toyota Way by Jeffrey Liker. The book presents value as a stream rather than discrete points. Value derives from how much any given step moves you towards the goal. Wasting time faster reduces cost, and doesn't add value.

In Thou Shall Prosper, Rabbi Daniel Lapin highlights the spiritual nature of value. If you put these two together, then we can see that value comes from the spiritual flow of something (parts, information, etc.) from one person to another. People are the most important part of the stream! The greatest gains come from an investment in people. Change people, and the rest follows.

Dr. Liker then explains how Toyota's just in time production. Just in time means making parts just as the next step needs them. You don't build up huge inventories of parts laying around taking up space. So what happens when a machine breaks? The entire production process halts.

Imagine how much that costs? The entire production of a Toyota car stops when a ten cent fuse goes out. The obvious answer, of course, is build up some inventory to keep the rest of the line moving while you fix the errant machine. Obvious, and wrong.

The manager of a Toyota plant has an incentive for preventive maintenance. Something in the electronics blew the fuse. If he just replaces the fuse, that same machine will break down again in a day or two. And it will continue ad infinitum. The cost is down time, parts, and labor every two days for the next three years. That comes to 16,425 minutes.

Now imagine that he spends two hours fixing the broken electronics - eliminating the short. The cost is two hours down time, parts, and labor. That's it. 120 minutes versus 16,425 - which costs less?

Solve the Problem

A huge inventory hides the true cost of the down machine. Just in time forces you to confront the cost face first. In Good to Great, Jim Collins promotes red flags. They signal a problem. And you can't simply dismiss them.

Red flags hurt. Red flags cause pain. Ignoring them costs far more than solving the problem. Just in time creates a red flag. Problems simply can't fester because they'll kill you first. Consequently, you fix them. Even better, you have a measurable way of justifying the right decision. That same red flag hurts your boss too. You help them by solving the problem instead of hiding it.

So how does all of this apply to software development? It's a core tenet of iterative programming. You don't push around an inventory of nuts and bolts. Our inventory is a bit more ephemeral, yet just as real - code. The iterations create red flag moments. When the client says "that wasn't quite what I had in mind," it's a red flag. Plotting progress every day is a red flag.

Iterative development promotes public accountability. Our cost is not in minutes or down time. It's in pride and merit. When a task turns out harder than I expected, that's embarrassing. Red flag. And I don't want it to happen again. The red flag makes me want to fix the problem - otherwise it will happen again.

Tuesday, December 15, 2009

Why Literate Programming?

Several years ago, looking for an outline editor, I stumbled across Leo. I was a proponent of comments, comments, comments. I used this really cool - and long - template at the start of every subroutine. Spell out every variable, its purpose, and how it arrived (global, parameter, or local). Describe the return value in exquisite detail. Establish draconian coding standards and follow them to the letter. If everyone writes code like me, then we won't have this lump of spaghetti.

Boy was I wrong! Leo talks about this notion of literate programming. We read books all of the time. Why is so source code so much more difficult to read? What if we wrote code like a book?

Source code is fundamentally hard to read because we write it for the computer. Read the line again - I'll wait. Did you get that? Did you really, really get that? The structure of my code, the order of instructions, everything focuses on how the computer works. No wonder a human being has trouble - they're not a computer.

100 MPH in the Wrong Direction

Coding standards, comment blocks, and language constructs utterly fail at producing readable code. These solutions ignore the fundamental problem - we're trying to write the same thing for two completely different audiences. Imagine a classroom with PhD candidates and kindergartners. Now explain how to draw a landscape - to both groups - at the same time. Not a very successful lecture.

Source code faces the same dichotomy. Humans and computers simply do not think alike. Computers require very precise, very specific instructions. They have almost no attention span. And can never grasp the big picture. In short, computers are kindergartners.

A human, on the other hand, likes the big picture. We understand our world by association. How things fit together gives as much or more information as the thing itself. When one piece of code relates with another, that has meaning to us. The code that sets a verbose flag belongs with the code that prints the verbose messages.

To the computer, sequence matters. To a human, relationship matters. And quite often, these two views are diametrically opposed. Who wins? The computer. Because the computer ultimately runs the software. If it can't understand the source, then you do not achieve your goal. Human comprehension takes a back seat.

Then it breaks. Two years later, kapow! The client is screaming. You're sleep deprived. And after mopping up the mess, you think how can I avoid this every happening again. When debugging, human comprehension matters more.

All of this to say - we code for two audiences because we have two audiences.

Full Circle

Literate programming recognizes and solves this exact problem. You write and format code for a human audience. Then tell the computer how to reformat that same code for itself.

The language compiler translates English into machine codes. Literate programming tools translate human structure into computer sequence. You target both audiences, without redundancy.

Sunday, December 6, 2009

Distribution of Wealth

No doubt about it, these are difficult times. Record unemployment. Bonuses for executives in bailed out companies. Lay offs. And a taxing burden on unemployment funds. Underlying much of the reporting is the undertone that rich people should provide for the poor.

We're confusing two separate issues: inequality and injustice.

You and me, we're all the same

The Bible assumes an unequal distribution of wealth. It's not a bad thing. Put down those pitch forks. Hear me out for a minute.

Genesis 47 tells about a famine in Egypt. The Egyptians sold their land and animals to Pharaoh for food. The Israelites, on the other hand, acquired property and prospered. Sounds a bit unequal.

In the book of Joshua (around chapter 13), God divides the land among the twelve tribes - in different amounts. Deuteronomy 21:15-17 recognizes the practice of the firstborn inheriting a double portion after the father's death. Is this equality?

God blessed Abraham with wealth. God blessed Israel in Egypt with wealth. God blessed Solomon with wealth. God distributes wealth.

Thieves, embezzlers, and villains

Injustice also occurs. People lie, steal, and cheat. They defraud investors. Embezzle from pension funds. Loan money with outrageous interest to people they know cannot pay. Yes, there are businesses that oppress the poor.

Likewise, there are businesses who provide a safe, clean working environment. They pay fair wages for a day's work. And they offer opportunities for bettering yourself.

Walk through your neighborhood. Guess what, some of your neighbors steal. So do you hate all of your neighbors? Crooks exist. Some crooks are rich. Some are poor. Money does not determine injustice. Injustice reflects who these people are - not what they have.

The Bible clearly speaks out against injustice. Proverbs 14:31 says the oppressor shows contempt for God. Proverbs 22:16 reveals the end of the oppressor - he comes to poverty. God decries injustice.

Redistributing wealth

Redistributing wealth fixes inequality, not injustice. Inequality isn't a problem. Injustice is the problem. So why do we rush to redistribute wealth?

We're selfish. That's our sin nature. Why should that guy have plenty of money when I'm struggling to make ends meet? I'm afraid. And in that fear, I take something that does not belong to me. I created even more injustice. I made the problem worse.

The Year of Jubilee

In the Year of Jubliee, land in Israel reverted back to its original owner. All debts were forgiven. Sounds great, right? Run up as much debt as you want and poof - it goes away. I hate to say it, Jubilee helps the creditor more than the borrower.

Proverbs 22:7 says the borrower is servant to the lender. Imagine eating lunch with a friend. Can they pay you back later for the meal? This was a nice lunch, so it ran about $20. You agree. Three weeks later and no money. You ask once. They say sure, just a few more days. They start avoiding you. Depending on how much you need the $20, you start avoiding them. The relationship changed.

Now imagine loaning $50,000 to a neighbor. This is exactly what your bank does with a mortgage. When the borrower pays, everything works well. When payment is late, the relationship goes south. Enough bad relationships, and you get a bad reputation. Can you afford to lose $50,000?

Step back to your lunch again. Instead of just agreeing to pay later, you tell your friend yes. And if you don't get the money in 30 days then it's a gift. How does that affect you? You already let go of the $20. That money is as good as gone. You don't need to ask about it. There is no sense of dread when looking at that person. You gave them the money, and that is that.

Jubilee created that mind set on a large scale. The creditor was smart. He stood to lose all of his money. And he entered the contract knowing that would happen. You could help a neighbor financially without the risk of life long alienation. Jubilee did not re-distribute wealth. It changed the creditor's behavior.

Do as I do

And there lies the key. Finances is not about money. It's about behavior. Because what we do reflects who we are.

Taking money from one person and throwing it at another does nothing for their behavior - giver or receiver. And so it solves nothing. This is why charitable giving always does more good than government. Because the giver changed their behavior. It can also inspire the receiver to change theirs.

Yes, God calls us to give. Yes, we should reach out with monetary gifts to those in need. And we do that because we love them. Change your behavior, not your tax structure.