A Default Identity Value for Programming

Michael Feathers
December 19, 2013

Default values can make programming easier. On the other hand, they can confuse us a bit. In C and C++ default values are considerable work. We need to know when the language (or our abstractions) are providing them and when they aren't. In some languages, things are clearer - numerics are always initialized to a flavor of zero.

. . .

Read More

Making Map Operations Implicit in Programming

Michael Feathers
December 17, 2013

Every once in a while a couple of ideas come together. I was running a workshop on error handling the other day and over the course of it we started discussing the Maybe monad and Scala's Option type. I put this example from the Scala docs up on the screen:

val name: Option[String] = request getParameter "name"
val upper . . .

Read More

Private Languages in Code

Michael Feathers
December 10, 2013

There are many ways of writing incomprehensible code. Most of us have tried many, but every once in a while I see a new one.

About a year ago, I looked at a large method that set a series of boolean flags up at the top and referred to them about 300 lines further along in its body. It's easy to look at this and say that the root . . .

Read More

When A Method Can Do Nothing

Michael Feathers
November 19, 2013

Refactoring is full of choices. When I start to work on a large method I look at its overall structure and try to get a sense of how to break it down. Conditional statements are often problematic for me.

 if (...) {

When I have an if-statement like this I know that I have a choice. I can extract the if and its . . .

Read More

   Subscribe by email and never miss a post.