coding practices

programming languages

Pseudocode or Code?

Although I'm a huge fan of Code Complete -- it is my single most recommended programming book for good reason -- there are chapters in it that I haven't been able to digest, even after 16 years. One of those chapters describes something called the Pseudocode

By Jeff Atwood ·
Comments

unit testing

I Pity The Fool Who Doesn't Write Unit Tests

J. Timothy King has a nice piece on the twelve benefits of writing unit tests first. Unfortunately, he seriously undermines his message by ending with this: However, if you are one of the [coders who won't give up code-first], one of those curmudgeon coders who would rather be

By Jeff Atwood ·
Comments

performance

For Best Results, Don't Initialize Variables

I noticed on a few projects I'm currently working on that the developers are maniacal about initializing variables. That is, either they initialize them when they're declared: private string s = null; private int n = 0; private DataSet ds = null; Or they initialize them in the constructor:

By Jeff Atwood ·
Comments

open source

The Code-First Dictum

Traditional wisdom says that the "code first, design later" approach is a bad idea. However, Charles Miller points out that when it comes to open source projects, it's mandatory [https://web.archive.org/web/20060209222222/http://fishbowl.pastiche.org/2005/05/08/finding_discord_in_harmony]

By Jeff Atwood ·
Comments

prototyping

The Prototype Pitfall

Tim Weaver, channeling Robert Glass, on the five laws of prototypes: 1. The answer to any prototype / feasibility question is always yes 2. Whatever poor coding practices you use to build your prototype will be replicated in the final production version 3. No matter how poor the performance of the

By Jeff Atwood ·
Comments

regex

If You Like Regular Expressions So Much, Why Don’t You Marry Them?

All right... I will! I’m continually amazed how useful regular expressions are in my daily coding. I’m still working on the MhtBuilder refactoring, and I needed a function to convert all URLs in a page of HTML from relative to absolute: <summary> converts all relative url

By Jeff Atwood ·
Comments

regular expressions

Regex use vs. Regex abuse

I’m a huge fan of regular expressions; they’re the Swiss army knife of web-era development tools. I’m always finding new places to use them in my code. Although other developers I work with may be uncomfortable with regular expressions at first, I eventually convert them to the

By Jeff Atwood ·
Comments