Live data from Hacker News

Clean Coder: The Dark Path (2017)

blog.cleancoder.com

11–20 of 71 posts

Re: Clean Coder: The Dark Path (2017)

#11
I understand what the author says, but in my experience, "Nullable Types" and "Open/Sealed Classes" are two different subjects and...

1) For "Nullable Types", I see that it is VERY good to think about if some type can be null or not, or use a type system that does not allow nulls, so you need some "unit" type, and appropriately handle these scenarios. I think it is ok the language enforces this, it really, really helps you to avoid bugs and errors sooner.

2) For "Open/Sealed Classes", my experience says you never (or very rarely) know that a class will need to be extended later. I work with older systems. See, I don't care if you, the original coder, marked this class as "sealed", and it does not matter if you wrote tons of unit tests (like the author advocates), my customer wants (or needs) that I extend that class, so I will need to do a lot of language hacks to do it because you marked as sealed. So, IMHO, marking a class as "open" or "sealed" works for me as a hint only; it should not limit me.

Re: Clean Coder: The Dark Path (2017)

#12

While I consider Uncle Bob a bad programmer, there is some merit to this article. This paragraph was particularly prescient: >But before you run out of fingers and toes, you have created languages that contain dozens of keywords, hundreds of constraints, a tortuous syntax, and a reference manual that reads like a law book. Indeed, to become an expert in these languages, you must become a language lawyer (a term that…

Yeah once you get into Monofunctor or 'PorcelainPile' lawyering you know you went too far

Re: Clean Coder: The Dark Path (2017)

#13
post #2

Author argues against strong typing systems and language features to prevent classes of bugs and instead encourages developers to "writing lots of tests" for things that a type system would prevent. The authors thesis seems to be that it's preferable to rely on the programmer who wrote bugs to write even more bugs in tests in order to have some benefit over a compiler or type system that can prevent these things from…

I think you you're missing the point though, he did not say that adding those constraints was a bad idea per se, but they are leading to a bad path. If the path is "just add more guard-rails" then we will get to a point where we lose the "soft" part of "software" and you'll find yourself restarting each time you need to change something because at that point the language you chose was already the first wall of a bad program architecture (ease of change).

Re: Clean Coder: The Dark Path (2017)

#14
post #7

Your elevator should not have automatic doors, doors are restrictive. They stop you from quickly jumping out of the elevator if you decide that you actually want to stay at the first floor. Sure, we’ve seen some pretty gnarly accidents, and there is no reasonable situation where risking death is a sane choice. But ask yourself: is it the elevator's job to prevent an accident? If you think so, I suggest you never leav…

> “never wear a helmet you coward”. Unironically the biggest flame-wars I ever saw on forums back in the day was on whether or not mandatory bike helmets made cycling safer or more dangerous.

I can understand, I’ve had some awful bicycle accidents while not wearing a helmet and the helmet would have made no difference. My knees, hands and elbows have been through a lot but I have never hit my head. Even while skateboarding the one time I hit my head a helmet would not have helped. In hindsight I should have worn knee pads a lot more often but then I wouldn’t be able to tell if it’s gonna rain or not from the feeling in one of my knees :)

However if I had to ride on a public road with cars zooming pass me recklessly I would absolutely wear a helmet on a bicycle.

Re: Clean Coder: The Dark Path (2017)

#15
post #9

> Every time there’s a new kind of bug, we add a language feature to prevent that kind of bug. That's why learning more academic, 'non-practical' aspects of computer science is sometimes beneficial. Otherwise very few will naturally develop the abstract thinking that allows them to see uncaught exception and null pointer are exactly the same 'kind of bug.' Anyway the author got it completely upside down. The stricter…

As someone not familiar with Haskell and Ocaml, which parts of Java are poorly implemented?

Re: Clean Coder: The Dark Path (2017)

#16
What I read between the lines: “I have such a fragile ego that I feel offended when a tool points out a mistake I made. I feel intellectually rewarded by doing the same busywork over and over again. I don’t want to change the way I do my work at all. I feel left behind when people other than me have great ideas about language design.”

Re: Clean Coder: The Dark Path (2017)

#17
post #15
post #9

> Every time there’s a new kind of bug, we add a language feature to prevent that kind of bug. That's why learning more academic, 'non-practical' aspects of computer science is sometimes beneficial. Otherwise very few will naturally develop the abstract thinking that allows them to see uncaught exception and null pointer are exactly the same 'kind of bug.' Anyway the author got it completely upside down. The stricter…

As someone not familiar with Haskell and Ocaml, which parts of Java are poorly implemented?

There are many, but one particular example is the type syatem.

Re: Clean Coder: The Dark Path (2017)

#19
I was rewriting a mod for Rimworld recently. As Rimworld is built on Unity, it's all some sort of C#. I heard people say it's a wrong kind of C#, but since a) I had no choice and b) I never wrote any C# before I cannot tell.

First, C# proudly declares itself strongly-typed. After writing some code in Zig (a project just before this one, also undertaken as a learning opportunity, and not yet finished), I was confused. This is what is called strong-typed? C# felt more like Python to me after Zig (and Rust). Yes there are types. No, they are not very useful in limiting expression of absurdity or helping expression of intent.

Second, test. How do you write tests for a mod that depends on an undocumented 12 year old codebase plus of half a dozen of other mods? Short answer - it's infeasible. You can maybe extract some kind of core code from your mod and test that, but that doesn't help the glue code which is easily 50-80% in any given mod.

So what's left? I have great temptation to extract that core part and rewrite it in Zig. If Unity's C#-flavor FFI would work between linux and windows, if marshalling data would not kill performance outright, if it won't scare off potential contributors (and it will of course), if, if...

I guess I wanted to say that the tests are frequently overrated and not always possible. If language itself lends a hand, even as small and wimpy as C#'s, don't reject it as some sort of abomination.

Re: Clean Coder: The Dark Path (2017)

#20
post #14
post #7

Earlier quoted context omitted.

> “never wear a helmet you coward”. Unironically the biggest flame-wars I ever saw on forums back in the day was on whether or not mandatory bike helmets made cycling safer or more dangerous.

I can understand, I’ve had some awful bicycle accidents while not wearing a helmet and the helmet would have made no difference. My knees, hands and elbows have been through a lot but I have never hit my head. Even while skateboarding the one time I hit my head a helmet would not have helped. In hindsight I should have worn knee pads a lot more often but then I wouldn’t be able to tell if it’s gonna rain or not from…

And there are countries where everyone rides a bike, and they are not usually the ones with mandatory helmets. When you hit someone with a bike you are less likely to kill them than when you hit them with a car, so more bike riding means less deaths, without even considering the effects of air pollution.

Helmets are fine for sport riding, but inconvenient if you want to ride 5 minutes to the shops on a whim. And that kind of riding is usually less intense and safer, I presume, anyway. Football has helmets, walking doesn't.

Post reply on HN