Non Gamstop CasinosNon Gamstop CasinosNouveau Casino En LigneCasino En Ligne FiableMeilleur Casino En Ligne

Posts Tagged ‘reply’

Reuse vs. Use Once

Thursday, August 7th, 2008

Brent Simmons just put a post up on his design philosophy for category methods, in which he presents the following rule:

If something is used just once, don’t make a category for it, just make it a static C function. Unless it’s big.

His reasoning is as follows:

  1. Less code to maintain. (And, in this case, two fewer files: one deleted .h and one deleted .m.)
  2. The code appears where it’s used: no need to jump to it if I need to edit it.

I’ve had this rule for a while, as well, and I think it’s a good one. But I have a third reason for employing it: if you’re only using a method in once place, you have no idea how it’s going to generalize. Maybe you can reuse it, as-is, in many other places. Perhaps it will need to be decomposed.

But trying to figure this stuff out the first time you need the functionality is a waste of time, because you’re likely to guess wrong. It’s better to save your energy for when you don’t have to guess at all: the second time (or the third time, or the fourth time) that the problem shows up, when you can refactor your way to a truly general solution.

Comments

apt-get install macosx

Sunday, November 11th, 2007

Dear Mark,

Please let me know when I can use Synaptic to install Mail, Safari, NetNewsWire, MarsEdit, iChat, Address Book, iCal, Preview, iTunes, iPhoto, Time Machine, TaskPaper, TextMate, Xcode, Yojimbo. Acorn, Automator, Dictionary, DVD Player, Front Row, Spaces, Exposé, the Dock, Finder, Garage Band, iMovie, Pages, Keynote, OmniGraffle, Transmit, Twitterific, and Xtorrent.

I’ll be waiting here, with my translucent menu bar, plus everything above. Hoping to hear from you soon.

Love,
Evan

Comments

Community picks