News for hackers. Stuff that matters.
Re:Strong typing, a hill I'm willing to die on by digging on Wednesday October 04, 2023 @12:15PM (#37767329)
> The argument that it helps inexperienced developers approach the codebase is, IMO, a poor one as it tends to incentivize an iteration loop that lacks understanding and is simply trying to make all the red go away. In fact I find that the type system is often a barrier to truly understanding what's going on as it effectively adds a very domain specific language to every project that has to be learned on top of the language itself.

This is very interesting and at first blush strikes me as backward. I wish I could sit in your office and see this happening, because I find it hard to imagine and I would love to know what that looks like. (And I have way less experience than you so I'm not saying it can't happen.)

Specifically, I find the domain-specific logic in my field is impossible to grok in dynamically typed codebases, while statically typed ones actually teach the developer what the business logic is.

> I may just be a grizzled greybeard screaming "the code _is_ the documentation"

Also confusing to me! In all my experience, static typing is what allows the code to be the documentation. Without it, there's no way to know what properties this object has or why we have a check for this certain property that I thought didn't even exist on this object. (Other than comments - maybe I'm on a weird team but I don't know anyone other than me who leaves comments of any significance.)

Re:Strong typing, a hill I'm willing to die on by spankalee on Wednesday October 04, 2023 @02:50PM (#37769832)
Comments are great, but they should usually explain why, not what.

Good, long variable and function names, along with breaking complex expressions into multiple statements with those nice variables names can help the code itself describe the what of the process. And then static types help describe the what of the types of data even more.

That lets you save the comments for more useful things than an ad-hoc type system, like "// We need to do this because..."

Re:Strong typing, a hill I'm willing to die on by hparadiz on Wednesday October 04, 2023 @03:19PM (#37770226)
Code coverage reports with complexity score for every function is the best teacher for this. I particularly love how Scrutinizer CI does this.