Extracting Immutable Objects
Code: design, design patterns, email, ListLibrary.net, mailing lists, object orientation, Ruby
In the last few weeks I’ve been rehabilitating some of the first object-oriented code I wrote in the hopes of bringing my mailing list archive back online. Lately I’ve been refactoring some of the earliest, core code: the
Message class. It manages the individual emails in the system and, because I didn’t understand how to extract functionality, had turned into something of a God Class.
Yesterday I tweeted about a really satisfying cleanup:
It’s Steve Yegge’s fault that I was rethinking the singleton pattern. I read his Singleton Considered Stupid post in early 2008 with the rest of the proggit before it devolved into a memetic garbage patch. Yegge’s rant ends with a note about design patterns that curled up in my hindbrain and has been whispering to me since: