Feb
26
2007
I was talking to some of the people at my new contract here, and I realized I never posted this revelation.
There is an partial solution to that annoying Java equals/compareTo issue. After you know that the object that you are comparing to is apparently equal to you, you then need to return this.hashCode() == them.hashCode(). Assuming people have properly overridden hashCode, this should mostly keep you safe.
Of course, there is the unfortunate possibility that you could get a false positive here: the quality of your hashCode calculation will determine how likely that is. And the this.getClass().equals(them.getClass()) || them.equals(this) can have infinite recursion of two sibling classes are accidentally equal to eachother.
So I’m still struggling with this. Help?
Popularity: 2% [?]
Feb
25
2007
We’ve had two major snowfalls this year. And in both cases, our association left us snowed into the house for over a day. That’s just unacceptable.
To give you an idea what I mean when I say “major snowfalls”, check out the pictures.
The Pile-Up at the Garage Door
The Pile-Up at the Garage Door with Our Hero for Perspective
A Gnome Hat on a Light Sconce
The Gnome’s Hat and a Side Shot
Edit: I’m 80+% done, and the snowplow and bulldozer just arrived — at 10:48 PM, after we lost a full day to being snowed in.
Popularity: 2% [?]
Feb
20
2007
The paper that BHurt and I co-authored for TFP 2007 wasn’t accepted. There was a lot of positive feedback about the core of the paper, but they weren’t so keen on the execution. I’m a bit frustrated right now, because I expected TFP to be predominantly academic in focus, and so the paper had that focus in mind — but the feedback all said that they wanted more case examples, and less high-level conversation. It turned out that the amount of effort that went into building an academic backbone and cites left the reviewers feeling like there was an empty foundation.
Good topic, good approach, but issues on the implementation. Blargh.
Popularity: 2% [?]
Feb
18
2007
Raganwald’s Excellent Post on Closures
It’s also a nice munition for those of you out there trying to convert Java developers over to Ruby.
Popularity: 2% [?]
Feb
17
2007
Okay, working on my web app using Ruby on Rails, and I just encountered a new gripe. Now, it may be a newbie gripe, or it may be a genuine issue — I’m not so sure. I’m looking for help if anyone’s got it, but I’m not finding it in either of the $40 books on Rails I’ve got at hand.
Let me first set the stage. In application models (this is “models” as in “Model-View-Controller”), you will often have a relationship between two models. And these models can be represented in a number of ways: for instance, one model might contain a list of instances of another model. Unfortunately, the coding for that model is done in the model within the list, not the model having the list. Which means, as far as I can tell, that every model can only be in a single list. And I’ve encountered a modelling situation where I want a model to be in multiple lists.
So how do you solve this in rails? For the time being, I’ve created intermediary models anywhere I want there to be a list (similar to using a model to represent a join). There’s got to be a better solution.
Popularity: 2% [?]