[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Seeking Advice about refactoring and advice snippet
From: |
Filipe Silva |
Subject: |
Re: Seeking Advice about refactoring and advice snippet |
Date: |
Fri, 10 Feb 2017 14:22:19 -0200 |
Hi Yuri, this WET principle is very insteresting and I should apply it
more. Thanks for sharing it!
In the interest of learning elisp properly though, I'd like to be able to
perfom this simple refactoring, because that would
improve my knowledge of elisp. This is a very simple operation that I
should be capable of performing.
[]s
Filipe
On Fri, Feb 10, 2017 at 11:08 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> On Fri, Feb 10, 2017 at 6:43 PM, Filipe Silva <filipe.silva@gmail.com>
> 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 :)
>
- Seeking Advice about refactoring and advice snippet, Filipe Silva, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet, Narendra Joshi, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet, Yuri Khan, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet,
Filipe Silva <=
- Re: Seeking Advice about refactoring and advice snippet, Filipe Silva, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet, Stefan Monnier, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet, Chunyang Xu, 2017/02/10