31
Mar 06

Single-exit functions

Ivan Moore suggests that single-exit functions should be considered cargo cult. I don’t think so. My suggestion for improving his sample code is as follows:

void foo(boolean condition)
{
    int returnValue = 6;
    if (condition)
        returnValue = 5;
    return returnValue;
}

Single exit. I even managed to save on a rather confusing else. Short. Easy to read. Even easier to understand.

Anyway, as long as we’re dealing with code of the complexity like the function shown, it doesn’t really matter if you use the single-exit rule or not (As long as you don’t work in my team :-). Single-exit becomes important if your function gets longer & more complex. However, if your function gets substantially longer and substantially more complex, you should consider refactoring it anyway.


31
Mar 06

Dependency Injection Demystified

James Shore: Dependency Injection Demystified.


30
Mar 06

Variable/Function/Object/Class naming

Coding horror: “Creating good names is hard, but it should be hard. Good variable, object, and function names can make the difference between Daily WTF code and.. well, code you’d actually want to work on.”
Click on both links.


30
Mar 06

Short Methods and Small Classes

If you’re used to writing & reading long methods, dealing with small methods & classes can take some time to get familiar with. Keith Ray has a great writeup on Reading Short Methods and Small Classes.
He also cites Jerry Weinberg’s great test to determine if a function/method is too long:

  1. Pick a function.
  2. Understand it, what it’s supposed to do, how that is accomplished.
  3. Memorize the function.
  4. Then, without looking at the original code, write the function from memory.
  5. If you’ve made a mistake, the function was too long, or otherwise too complex.


30
Mar 06

Marketing Biathlon

Another great Dilbert.


25
Mar 06

Ideal workplace?

Nial Kennedy on theOffice, creating the ideal workplace for indie writers.
Cool.


23
Mar 06

Herb Sutter on Concurrency

The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software.
This is a must-read if you’re a software developer or into computer science. But don’t stop there. Here is great talk (for your podcasting pleasure) by Herb Sutter on this very topic (slides). It offers way more in-depth information, analysis and insight on the topic than the article.


21
Mar 06

Getting Real

There’s a new book out there by 37signals called Getting Real. True to their philosophy of less features, it’s PDF only.
Not enough features, folks.
If they would have a dead-tree edition of the PDF, I would buy it right away.
* Reading a book on the screen sucks
* Printing out 171 pages on an aging, constantly-paper-jamming laser printer sucks even more
* Reading a stack of 171 (or 171 / 2) DIN A4 / US letter sized sheets of paper while sitting on the, uhm, well, “throne” sucks royally (*).
There’s no alternative to the clean, user-friendly UI of a book.
(*) Hey, I’m a married man & dad of two wonderful daughters. Sitting on the, uhm, well, “throne” is the only time I have left to read a book in peace & quiet)
[Update: No, I don’t want to bind my own paperback book]


20
Mar 06

DabbleDB

Watch this: Dabble DB Demo.
Database stuff still is cool.


12
Mar 06

Textboxes

Coding Horror:

Web Forms: Death By a Thousand Textboxes

Interesting thoughts on reducing the number of textboxes & text entry controls in a UI.