multipart-mixed

Coming to a Bookstore Near You

First, thanks to all the readers who followed my PragProWriMo 2009 writing--your support was invaluable. I'm happy to announce that Pragmatic Bookshelf picked up my book in December and I'm busy finishing the first draft. I'm not sure how long the whole process will take, the optimist in me wants to believe I can finish by the end of the year. Either way I'm very excited to bring this book to fruition and the folks at Pragmatic are fantastic to work with.

Quality: Beginning vs. Afterward

Yes, PragProWriMo 2009 was over yesterday. However, I can’t introduce the topic of quality and then just stop there, can I? After this it’s time to start working on my book proposal.

There are two approaches to building a quality product: build it in from the beginning, or beat it in afterward. The former approach requires a lot of discipline and effort from the engineering team. The latter requires a lot of testing and, again, effort from the engineering team.

Continue reading "Quality: Beginning vs. Afterward" »

Quality is Job 0.99999

This is intended to introduce a chapter on quality. There’s a myriad of topics here; this post is merely setting the stage.

I take it as a given that any product should be a high-quality product. Why bother making it otherwise? This seems like a straightforward goal, but the technology industry has had a hell of a time figuring out how to build quality software. There’s a joke that’s been around for at least a decade:

There’s word in business circles that the computer industry likes to measure itself against the Big Three auto-makers. The comparison goes this way: If automotive technology had kept pace with Silicon Valley, motorists could buy a V-32 engine that goes 10,000 m.p.h. or a 30-pound car that gets 1,000 miles to the gallon—either one at a sticker price of less than $50. Detroit’s response: “OK. But who would want a car that crashes twice a day?”

Any good joke has an element of truth to it—this one especially so. Auto makers can build cars that’ll drive hundreds of thousands of miles, but Windows 95 would crash after 49.7 days of continuous operation—a bug that took four years to discover 1 because other bugs would crash Windows 95 long before 49.7 days could pass.

Continue reading "Quality is Job 0.99999" »

Platforms

It used to be that the “user interface” for a computer was assembly language and its “user manual” was the programming manual. Back in those days, the distinction between the physical machine and its programming interface was somewhat academic.

These days, there’s a lot more layers involved. Taking the “simple” example of C++, the layers could look like this:

In this example, the physical machine is a x86, 64 bit. The machine’s architecture has various ramifications, for example a 64 bit machine can allow a single process to address much more memory than a 32 bit machine. The operating system has numerous implications; any “system call” like accessing a file goes through the operating system. Then there’s the libraries, for example the C standard library which provides functions like printf() for formatted output. Then there’s the programming language itself.

Continue reading "Platforms" »

Programming Languages

There are few topics that can get programmers riled up more than programming languages. Language flame-wars have been raging on Usenet since about the dawn of Usenet. They’ll continue burning until, as best I can tell, the end of time. Why? The programming language is your most-used tool (second only to your text editor) and it takes a long time to master, so it’s reasonable that people get attached to their languages.

In college you likely focused on one “do it all” language like Java. There’s nothing wrong with Java, in fact it’s a great language. The problem is the “do it all” part—no language does it all, at least not well. You simply cannot be productive and versatile without knowing a couple programming languages.

Continue reading "Programming Languages" »

Optimism

In the 90’s Bare Bones Software released a text editor called BBEdit with the tagline “It Doesn’t Suck.” It retains the tagline to this day. Truly brilliant marketing. Who’s their market? Programmers.

Programmers are pessimistic and sarcastic lot. The vast majority will tell you about a hundred things that suck for every one thing that doesn’t. The highest praise a programmer will give a product is, “it doesn’t suck.”

Pessimist programmers are in good company. I’ve read various reports saying the vast majority of projects fail. 80 or 90 percent. Adding insult to injury, it’s not the good 10 or 20 percent that succeed, it’s some hodgepodge of good and bad. It almost seems that bland to downright crappy products are more successful, on average, than really good ones. When a programmer says such-and-such sucks, chances are he’s right.

Continue reading "Optimism" »

Corporate Myths

Author’s Note: it’s really hard coming up with good examples for the assembly language discussion. Either I make something meaningful that compiles into pages of assembly, or I make something too trivial that compiles into nice snippets. I’ve tried three times to write about pointers and the balance still isn’t right. So today I’m flipping back to corporate life.

Executives and managers like to think they’ve got it all together. Walk with some swagger, put on the game face, don’t show weakness. Just as you learned about your parents, your management doesn’t always know as much as they say they do. I’m a manager, I’d know.

So let’s take a tour of myths you’ll probably hear in the corporate world. When you hear these, make a mental note: this guy is a bozo.

Continue reading "Corporate Myths" »

Functions and Parameters

This entry is a day late because I started writing about pointers, but I realized I needed to discuss function calls first.

Now that we’ve got the foundation of stack frames and the debugger for exploring them, we can use the stack for more than just local variables. The stack is also used for passing and receiving parameters to functions.

Let’s say I’ve got this very-nearly-useless function:

int sum3(int a, int b, int c)
{
    return a + b + c;
}

int main()
{
    sum3(1, 2, 3);
    return 0;
}

Continue reading "Functions and Parameters" »

Investigating The Stack With the Debugger

This section assumes I already covered some basics of GDB earlier in the book, which I plan to do.

Once you have some concept of registers and the stack, it’s time to play. Take our original example and save this as stack.c:

int main()
{
    int i = 0x11223344;
    char s[4];
    s[0] = 'f';
    s[1] = 'o';
    s[2] = 'o';
    s[3] = '\0';
    return 0;
}

Continue reading "Investigating The Stack With the Debugger" »

The Stack

Every thread in every process has a stack. This is where local state is kept, including:

  • All variables declared on the stack.

  • Parameters to function calls.

  • The pointer to the calling function’s stack base.

Let’s look at an example. Say my C code defined some variables on the stack like so:

int i = 0x11223344;
char s[4];
s[0] = 'f';
s[1] = 'o';
s[2] = 'o';
s[3] = '\0';

Continue reading "The Stack" »

Introducing the Machine

As best I can tell, the Intel 8086/8088 processor and its successors were designed by sadists. In the future, Skynet will win and the machines will destroy humankind because the great-great-[…]-grandfathers of the 8086 became so unfathomable that nobody could comprehend their function and, therefore, their evil plot.

I will focus on the 32-bit i386 instruction set because:

  • i386 32-bit instructions will work on both 32-bit and 64-bit x86 processors.

  • Most of the existing documentation, on the web and in books, covers i386.

  • If you don’t have an i386-compatible machine, you can buy one cheap, cheap, cheap and run a free operating system on it.

I will use the GCC compiler and GDB debugger for my examples. You can get this free for most any operating system; for Windows I would recommend running GCC under cygwin.

Continue reading "Introducing the Machine" »

The Tao of Computing

Author’s note: This post is intended to introduce a larger section of the book (at least a chapter), not stand on its own.

Expert programmers have all had “ah-ha” moments where, all the sudden, several concepts that were all unclear crystalize into one revelation and become clear. An expert mechanical engineer described this concept as going “above the clouds;” one moment you were lost in the soup, the next moment you break through the clouds and you can see clearly where you are and where you’re going.

Continue reading "The Tao of Computing" »

Code Reviews

At some point your code will be the subject of a peer review. Many programmers loathe, detest, and double-plus unlike code reviews, but there’s really no reason to. In fact, experienced programmers look forward to code reviews—we’ll see why shortly.

Person and Perspective

The reason so many code reviews go bad is because the programmer makes a connection between the his code’s worth and his self worth. When reviewers point out problems in the code, the programmer takes insult, gets defensive, and things go downhill quickly.

Continue reading "Code Reviews" »

Methods of Software Development

As a product gets larger and more complex, the development team needs to answer certain questions:

  • “When will it be done?” The rest of the company is waiting for the product to ship. They’ve got a rollout plan, a marketing blitz, perhaps manufacturing… all kinds of stuff that hinges on when the product will be done. So are we there yet?

Continue reading "Methods of Software Development" »

Software Over Time

NOTE: I’m really skipping around here. Let’s get away from business principles for a bit and focus on software.

In school, the lifetime of your programs is often days, weeks, maybe months at the very most. You’re given an assignment, some input data, and expectations about what the output should be. Write the program, turn it in, and now that program is dead.

That’s not how it works in industry. We’ve got a saying, “bad code lives forever.” In reality, it seems like most code lives forever, good or bad. The lifetime of a program is at least measured in years, sometimes decades. This one factor, time, has tremendous implications for how you write and maintain programs.

Continue reading "Software Over Time" »

Products, Customers, and Value

Do I need to keep saying this is a first draft?

From here out I’ll refer to “product” in the generic sense; something the customer uses, whether it’s a product or a service. But while I simplify that, I need to expand on who exactly this “customer” is and what value they get from the product.

Continue reading "Products, Customers, and Value" »

Products

NOTE: First draft.

Up until now I’ve been talking about a “product” that makes money. That’s a simplification of several factors. Let’s de-simplify.

Continue reading "Products" »

The Role of The Company

NOTE: I’m hopping around, and will continue to do so through the month. All usual “first draft” disclaimers apply, too.

Let’s say you’ve joined a company that’s setting out to change the world. When Frobnicator 1.0 ships, it’ll revolutionize people communicate, keep track of their kids, and do their laundry. That’s fine and good, but Frobnicator 1.0 is not the underlying reason the company exists.

Continue reading "The Role of The Company" »

Introduction: Overview

NOTICE: usual disclaimer applies. First draft. Structure of this book likely to change.

I obviously can’t teach you everything there is to know about industry. You’ll forge your own unique career path and no book could teach you exactly how to do that. But there’s a lot of common topics that I can address to help you get your career off on the right foot.

Here’s an overview of what’s to come:

Continue reading "Introduction: Overview" »

Introduction: Who Should Read This Book

So that’s where I’m coming from. Let’s talk about where you’re coming from. I expect fans of this book to fall into a couple broad categories:

  • College students taking Computer Science classes and wondering, “is this what programming is like in the real world?” (Short answer: no.)

  • College grads already in industry, who have noticed first-hand that the answer to the first question is “no,” trying to get their heads around the disparity.

  • People, young or not, who are considering a job in programming but want the skinny on what the books and classes aren’t telling them.

You’ll notice this isn’t a “…for Dummies” book. I assume you’re smart. You probably know a programming language or two. But until you’ve been in industry for a few years “you don’t know what you don’t know” about doing programming as a profession. That’s where this book comes in.

Introduction: Why I'm Writing This Book

NOTICE: this is a first draft for PragProgWriMo. It’s not polished. Posts may not be in sensible order. Read at your own risk.

Let me explain my motivation for this book with three stories.

The Advisor

First, my advisor at Duke University was known as the guy to have. He was young, bright, a Rhodes Scholar, and the star of the Electrical Engineering department. I went to him during my sophomore year and asked which of two courses I should take to fill a requirement, with the condition: which would be most useful in industry? He said, and I quote exactly, “I have no idea. I’ve never worked a day in industry in my life.” I left that meeting more than a little disillusioned—just what the hell kind of education was I getting here?

Continue reading "Introduction: Why I'm Writing This Book" »