jducoeur: (Default)
[personal profile] jducoeur
There I was, coding along, and realized that this clause -- to unsubscribe from someone's presence when they change their IM handle -- also needs to be over there, for the case where they simply delete their IM handle. I copy the code from place A to B, think about it a minute, slap myself mentally, and decide that I should be extracting a method instead.

So I go to code A, invoke Eclipse's "Extract Method", and *poof*, I have a new method. I go over to B, to replace my copied code with a method call...

... and it's already been done for me.

On the one hand, that's exactly what I wanted. OTOH, it's kind of spooky. It hadn't even occurred to me that Extract Method would go looking for duplicate code and refactor that as well. It's probably usually correct, but managed to hit a button I wasn't even aware of -- the "Waitaminnit, that's *my* code! Don't screw with it!" response was quite visceral...

(no subject)

Date: 2008-10-31 07:30 pm (UTC)
From: [identity profile] metahacker.livejournal.com
Huh. IntelliJ warns you about this step (you can click through it) and also gives you options for "find in comments/string constants/etc.", i.e., the non-code cases. But yeah, that's a bit weird... I like knowing where and how my software has changed my work under me. Good reminder of a design pattern, that. ("Ensure the effects of the user's actions are visible.")

Profile

jducoeur: (Default)
jducoeur

July 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27 28293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags