help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Seeking Advice about refactoring and advice snippet


From: Yuri Khan
Subject: Re: Seeking Advice about refactoring and advice snippet
Date: Fri, 10 Feb 2017 20:08:19 +0700

On Fri, Feb 10, 2017 at 6:43 PM, Filipe Silva <address@hidden> wrote:

> The problem is that these lines:
>
>       (message "DENIED! don't kill my precious *scratch*!!")
>      (apply buffer-assassin arguments))))
>
> Are repeated in both functions, so I thought that I could apply the DRY
> principle

I cannot say anything useful regarding your approach, but I can’t help
noticing that you are trying to reduce duplication of two lines in two
functions. This is not likely to help maintainability significantly.

In Extreme Programming circles, there is a principle called Three
Strikes And You Refactor, which says that you only have enough data
for a meaningful refactoring when you see three instances of the same
pattern.

Until you encounter that third instance, you could follow the WET
principle instead: Write Everything Twice :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]