Archive for object-oriented design

Oh OO, thou art a heartless bitch

Posted in Design Issues with tags , , , , , on August 11, 2010 by moffdub

Well, it has finally happened. I am dreaming about defects in our code. Dream in code? Dog, I live dream-in-code every day.

Time for a familiar argument, a familiar decision. You have a blank slate. You must define some data transfer objects for your consumer based on some requirements. You provide an interface that takes in one of these data structures and returns an XML representation of that data structure.

And, for the sake of this discussion, you are using Java’s XMLStreamWriter as your XML framework (I know, I know, there are much more uber l33t ways, but this was the most straightforward and painless way for you in the time-frame you were given).

Simple. SIMPLE. Right?

Option 1

By now, your nudge, your twitch, your instinct is to define an appendTo(XMLStreamWriter) method to each object, which either writes a simple tag or calls appendTo(XMLStreamWriter) on its constituents:

Read more »

Nowhere To Run: 52 – Heart

Posted in Nowhere To Run with tags , , , on July 24, 2010 by moffdub

Announcer: From the EIP Sylvanian Operations Center, somewhere in south-eastern PA, it’s Nowhere To Run!

<< Previous Next >>
Announcer: You’re reading the EIP web-ring.

Second-class citizens above the law

Posted in Design Issues with tags , , , , , on January 13, 2010 by moffdub

It’s not too late. Almost eleven months have passed since I favored a Long Parameter List over perceived Feature Envy on the grounds of coupling with the order of the parameters:

Long Parameter Lists are also about coupling, to a lesser extent. You are coupled to the order of the parameters.

I even said in that post that Feature Envy isn’t a clear-cut issue:

Let me share something about Tell Don’t Ask that I’ve realized: the most harmful instances that require attention are those where you get some values out of an object, do something with them, and set some others back into the object.

Yes. And then I defended the readability of a Long Parameter List:

Read more »

Follow

Get every new post delivered to your Inbox.