Clean Code: Intro, Clean Code and Meaningful Names (up to the end of chapter 2)
Tim Penhey
tim.penhey at canonical.com
Tue Sep 17 23:05:17 UTC 2013
On 17/09/13 18:20, Andrew Wilkins wrote:
> On Tue, Sep 17, 2013 at 2:02 PM, Jeroen Vermeulen
> <jeroen.vermeulen at canonical.com <mailto:jeroen.vermeulen at canonical.com>>
> wrote:
> Tim described duplication as a symptom. The difference is in
> identifying the cause. Sometimes it takes you in much better
> directions than the pursuit of de-duplication itself, and sometimes
> it leads you to accept mild symptoms over the alternatives.
>
> I wasn't very clear in my reply; I completely agree with what you've
> written. My response was not to Tim, but to the blanket statements in
> the book. There are several statements that read like "duplication is
> the devil". I'm just saying that you can go too far in the other direction.
I agree. There needs to be a certain level of pragmatism with this.
Code shouldn't necessarily be generalized for the sake of it just so it
can be used from multiple places, especially if it makes the code more
obscure or obtuse.
However, we do have places where we repeatedly do things, especially in
tests, where we can capture the intent with a higher level function,
like "OpenAPIAsNewMachine".
Tim
More information about the Juju-dev
mailing list