Live data from Hacker News

Essays on programming I think about a lot

benkuhn.net

61–70 of 99 posts

Re: Essays on programming I think about a lot

#61
post #52

Earlier quoted context omitted.

I still can't believe that I was actually there during that exact presentation but at the time it didn't have the impact on me that it seems to have had on HN as a whole. Maybe I should review it again, or maybe I'm just not smart enough / don't have the right mindset, IDK.

Rich Hickey seems to be a bit of a Necker cube. Some people i know and respect think he is a deep and powerful thinker. But to me his talks always seem like 90% stating the obvious, 10% unsupported assertions.

If you find 90% of his statements to be obvious, maybe all that means is that you're a deep and powerful thinker too?

Re: Essays on programming I think about a lot

#62
post #47
post #27

Earlier quoted context omitted.

You are abstracting over a CPU and memory. Your abstraction leaks in that memory layout actually matters for performance, for example. Or if you have a bad RAM chip.

> Your abstraction leaks in that memory layout actually matters for performance, for example. There are cache-aware abstractions if your situation warrants them. Of course if you abstract over a detail then you lose control over that detail. But that's not the same as a leak, and it's the very essence of programming at all; if the program needs to behave differently every time it runs, then creating a useful program…

Right. As they say, In theory there is no difference between theory and practice; in practice, there is.

Re: Essays on programming I think about a lot

#63
post #54

Earlier quoted context omitted.

I’m going through the conversation with a colleague atm where he believes DRY applies to everything.

The Sandi Metz talk/post included in the list touches on that: https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction My takeaway from it is that we need to distinguish what you might call essential from incidental duplication. Essential duplication is when two bits of code are the same because they fundamentally have to be, and always will be, whereas incidental duplication is when they happen to be the same at…

I don’t understand why people interpret that article as recommending you avoid prematurely removing duplication and comparing it to the rule of 3. The point of her essay is that you should resist the sunk cost fallacy and refactor your duplication-removing abstractions when requirements (or your understanding of them) change.

Re: Essays on programming I think about a lot

#64
post #2

So glad to see the Law of Leaky Abstractions in there - that's had a very long-running impact on how I think about programming. It's still super-relevant today, nearly 18 years after it was published. https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-a...

I’m going through the conversation with a colleague atm where he believes DRY applies to everything.

Some good resources about DRY:

> DRY is about knowledge. Code duplication is not the issue.

https://verraes.net/2014/08/dry-is-about-knowledge/

> Every piece of knowledge must have a single, unambiguous, authoritative representation within a system

https://wiki.c2.com/?DontRepeatYourself

Re: Essays on programming I think about a lot

#65
post #29

Earlier quoted context omitted.

Yeah that sucks. Especially when you're designing service endpoints and your colleague insists upon reusing an existing endpoint instead of opening up a new one, because the two use cases looked the same when he squinted hard enough. Now instead of /credit-card and /debit-card, which are independently testable, debuggable and changeable, you just have /card. Can't change the debit logic in /card because it will break…

I feel your pain. Probably well past 'fixing' now, but a 'type' could be passed in with the payload, even if it's not exposed as the URL itself, no?

I definitely would have done that if I had the choice.

However the endpoint owner just insisted I just send nulls for the fields I didn't have.

Re: Essays on programming I think about a lot

#67
post #17
post #16

Earlier quoted context omitted.

Interesting that you mentioned Haskell. In my experience, I've found that every type having a bottom makes a lot of abstractions leaky.

1. Every type has a bottom in every mainstream language, most of them are just less explicit about it. 2. Bottoms do not make abstractions leaky in some generalised sense. The "fast and loose reasoning is morally correct" result applies: any abstraction that would be valid in a language without bottoms is still valid wherever it evaluates to a non-bottom value.

[deleted]

Re: Essays on programming I think about a lot

#69
post #27
post #26

Earlier quoted context omitted.

I don't think that's true. A lot of these abstractions are provably correct and so simply cannot leak (and in slightly more advanced languages you might even enforce those proofs - consider Idris' VerifiedMonad and friends). Of course if you put garbage in at the lower levels (e.g. define a monoid instance that doesn't actually commute) then you will get garbage out at the higher levels (e.g. the sum of the concatena…

You are abstracting over a CPU and memory. Your abstraction leaks in that memory layout actually matters for performance, for example. Or if you have a bad RAM chip.

> You are abstracting over a CPU and memory. Your abstraction leaks in that memory layout actually matters for performance, for example.

I find the idea that an abstraction is leaky if different implementations of it perform differently to be fairly useless. I don't think it's a useful concept unless the abstraction captures the expected performance. If the abstraction doesn't give any performance guarantees, then the caller shouldn't have any performance expectations.

Similarly to abstractions around accessing a file on disk that might fail. The abstraction should account for potential failures. If it doesn't account for failures, but the implementation does fail, then it's meaningful to call it leaky.

Re: Essays on programming I think about a lot

#70
post #8

Earlier quoted context omitted.

It's nonsense, written because Joel had never used a language with a decent type system. Any Haskell programmer uses half a dozen non-leaking abstractions before breakfast. Even the examples in the post itself don't hold up - using UDP instead of TCP doesn't actually mean your program will work any better when someone unplugs the network cable.

Is it possible that you are misinterpreting what Spolsky meant? I think he means that in the real world we interact with implementations of abstractions, and that the implementation always shines through and can bite you in the ass. This is what makes side-channel attacks possible, and (in Spolsky's view) unavoidable.

[deleted]
Post reply on HN