News for hackers. Stuff that matters.
Re:How to Use Go Interfaces by peterevans on Monday March 19, 2018 @08:28PM (#16624813)
Abstractions are not a bad thing, but early abstraction often lacks understanding of the problem to solve. Abstraction is complexity. We often need complexity, but we should not add complexity without cause.

And I don't think this is a Java vs. Go thing. Let the program, or the problem if you will, prove to you where you need abstraction.

Re:How to Use Go Interfaces by frou_dh on Tuesday March 20, 2018 @04:52AM (#16626905)
An interface whose purpose is to reduce known coupling is not really "abstraction". It's a mechanism for indirection.

IIRC Zed Shaw had an essay on this.

Re:How to Use Go Interfaces by balefrost on Tuesday March 20, 2018 @09:41AM (#16628427)
To be fair, that Zed Shaw essay isn't particularly good.

1. He uses lay (i.e. non-technical) definitions of "indirect" and "abstract" to argue that the technical definitions are somehow flawed. Words have different meanings in different contexts, but he rejects those different contexts.

2. He argues that abstract classes in Java are actually a form of indirection because the abstract modifier "creates an indirect path to the real implementation". This is after he covers that "abstract" can mean "a concept or idea not associated with any specific instance".

3. He claims that no lay definition of abstraction permits the idea of "swapping out the implementation". He fails to understand that, from the client code's point of view, "swapping out the implementation" is a direct consequence of coding to the abstraction.

4. In the words of Rich Hickey, I think Zed is conflating Simple and Easy.

I don't doubt that Zed saw something legitimately objectionable and that drove him to write the essay. But in trying to formulate his point, I think he ended up conflating ideas, relying on false premises, and built an argument that didn't have much of a logical progression.

He's essentially saying "I'm right and everybody else is wrong because I looked it up in a dictionary."

Re:How to Use Go Interfaces by chewxy on Tuesday March 20, 2018 @05:33AM (#16627039)