Law of Demeter

May 9th, 2010

Recently I have read some articles that have mentioned the Law of Demeter, and not having heard of it, I went looking for it. Blatantly stolen from the article, the Law of Demeter is as follows:

A method “M” of an object “O” should invoke only the
the methods of the following kinds of objects:

  1. itself
  2. its parameters
  3. any objects it creates/instantiates
  4. its direct component objects

 Why is this a good thing? In simple terms, following the Law of Demeter, you enforce encapsulation of a method’s implementation and dependencies on other objects. Should that method have to change at a later time, it minimizes the impact on callers of the method, localizing the change to the method in question and its subordinates.

For more information, and perhaps a more succinct explanation, see the linked article above.

Refactoring Is Not Up To You

May 9th, 2010

As a software contractor, and previous employee at many software shops, I have seen some amazingly well built code, and unfortunately my fair share of the horrible. To steal a quote from one of my favorite movies:

“I’ve seen things you people wouldn’t believe…”
 – Roy Batty, Nexus 6 Replicant, Blade Runner

I’ve seen the use of design patterns for the sake of having used a design pattern, with interfaces so generalized that types have been thrown out the window so as to refer to all parameters and return types as simply java.lang.Object. I’ve seen applications written in C++ where pointers to proper objects have been re-cast as unsigned long, totally stripping type information (and the fact that the value is a pointer), passed around and then re-cast to a (hopefully appropriate) object type elsewhere. I have seen Translator objects, written to perform translation between DTOs and general Beans meant to be consumed at the User Interface level, that also including translation from HTML form attributes to both DTOs and Beans. I’ve seen hard-coded character buffers in C/C++ applications that are easily overrun when std::string was readily available.

I have seen the Big Ball of Mud up-front and personal. Read the rest of this entry »

HP Solution Center 13

April 20th, 2010

Back in September, I decided I was going to try and keep all my company documents in electronic format for easy filing. Sure, I’d keep all the originals in my fire safe, but I wanted to be able to pull up anything at a moment’s notice and e-mail/fax it as necessary from wherever I was. I decided I needed a good scanner with an auto document feeder.

Enter the HP ScanJet 5590. Looked good, wasn’t too expensive, was rated for light office work, I thought I had found a winner. So I ordered, received and installed the little beastie on my Dell Precision M4100. And then disappointment set in. Read the rest of this entry »

Obligatory “Hello World” Post

November 1st, 2009

It’s late on a Sunday night, the night before I attend Microsoft Tech-Days 2009…

…and my website is non-existent.

So, like many others on the ‘net, I resort to WordPress. Check back in the near future, I promise to have better content than this.