Live data from Hacker News

Cold Showers

github.com

31–40 of 363 posts

Re: Cold Showers

#31

> Static Typing reduces bugs. At least to me, the big advantage of static typing is not that it (allegedly) reduces bugs, but that it aids my understanding and helps in navigating the program. It's a tool for thinking and communicating.

As long as the types, variables and function names have proper names. And not `A -> A -> B -> [B, D]` (looking at you, Haskell).

Re: Cold Showers

#32
Where I work, static analysis has found quite a few bugs. It's primarily through CodeQL and I think it's greatest strength is how flexible it is. Our code base is weird (it's C++ and has its own memory allocators and schedulers).

Re: Cold Showers

#33

Earlier quoted context omitted.

This one definitely hits close to home. By empirical measure, static typing reduces bugs, but maybe it's just me. I definitely like the comfort of trusting my types. My only experience with dynamic typing is really node, which improves a bit with typescript. But I'm still extremely wary of it because it doesn't give you runtime guarantees. It irks me a lot that you can just do JSON.parse, declare any type on it and c…

> By empirical measure, static typing reduces bugs As the article says, this does not appear to be actually true when you go and check.

The article mentions the literature review is from 2014.

Many older statically typed languages (Java/C/etc.) don’t enforce null safety. Tony Hoare called it his ‘billion dollar mistake’.

https://en.wikipedia.org/wiki/Tony_Hoare#Apologies_and_retra...

Thankfully more modern type systems (Swift/Kotlin/F#/Rust/TypeScript/etc.) now do, hugely reducing the likelihood of runtime errors.

As a mostly dynamic language developer I never saw the benefit of Java-like static typing but more modern type systems seem much more useful.

Re: Cold Showers

#34

Earlier quoted context omitted.

> By empirical measure, static typing reduces bugs As the article says, this does not appear to be actually true when you go and check.

Well, how is this measured? My experience working over 3 decades with large teams also says this is so (static typing does prevent bugs) but that is not science. How do they measure this 'when you go and check'? I am really curious as I don't even understand how people make large systems without static typing and all massively complex systems that I personally have worked with that run for decades transacting billion…

We don't seem to be able to measure it, despite people trying several wacky approaches.

Either that means it's hard to measure, or it means the effect is not actually there.

Either way, this means that we cannot say that static typing reduces bugs.

> all massively complex systems that I personally have worked with that run for decades transacting billions$ etc without flaws are all statically typed

Did you try building the same systems without static typing as well and see what the difference was?

Or are you just saying that you built systems with static typing and they were successful? That tells you nothing about static typing except that it doesn't prevent successful programs, which is a very weak thing to be able to claim!

Lots of people, like you, think static typing is very important for developing software, but when someone challenges this and says 'can you actually show that?' they have never been able to. At some point you need to reconsider if it's actually the case.

Re: Cold Showers

#35
post #15

> "Static Typing reduces bugs." I would argue that static typing reduces bug complexity/creep. Mainly from working in environments without proper testing during the js days, TS was rough at first, but did help.

I don’t know about static types reducing complexity. I’d argue the opposite. Static types allow you to do things that you wouldn’t want to attempt with dynamic types due to the difficulty of reasoning. At least for me, I try to keep my dynamic systems simple because I don’t have a compiler watching my back.

Complexity in relation to tracking down the bug of course*

Interesting though, I would say that dynamic typing allows you to shoot yourself in the foot a bit more, especially over teams who might need to interact with source later. I agree with you to keep the dynamic ones (that are inevitable) simple though.

Re: Cold Showers

#36

Earlier quoted context omitted.

I thought I wanted static typing until I started writing clojure.

Clojure is the only dynamic language I’ve ever loved. It is in its own ballpark, really, though maybe Erlang or Elixir would win me over if I spent enough time with them.

I’ve actually been spending the last year with elixir professionally. I’m embracing some of it… I would love to see its pattern matching and annotations come over to clojure, and would make my clojure code even more “correct.” I don’t super fully “get” all of its message passing plumbing, and I don’t like the quality of its library ecosystem.

But clojure’s REPL, babashka, and clojure.spec are sorely missed.

Re: Cold Showers

#37

Earlier quoted context omitted.

> By empirical measure, static typing reduces bugs As the article says, this does not appear to be actually true when you go and check.

The article mentions the literature review is from 2014. Many older statically typed languages (Java/C/etc.) don’t enforce null safety. Tony Hoare called it his ‘billion dollar mistake’. https://en.wikipedia.org/wiki/Tony_Hoare#Apologies_and_retra... Thankfully more modern type systems (Swift/Kotlin/F#/Rust/TypeScript/etc.) now do, hugely reducing the likelihood of runtime errors. As a mostly dynamic language develop…

> hugely reducing the likelihood of runtime errors

You say this like it's a fact... but again nobody has been able to show this in a proper scientific study.

Re: Cold Showers

#38

Earlier quoted context omitted.

I thought I wanted static typing until I started writing clojure.

I occasionally missed types even in Clojure. “What keys are supposed to be in this map again? Hmm, turns out some callers are providing foo and some are providing bar…” That said, I certainly agree it comes up less than it does in, say, JavaScript

I agree. In another comment I mentioned how I think Elixir’s pattern matching and annotations (type specs) would take clojure to that next level and strike a perfect balance between between ergonomics and correctness.

Re: Cold Showers

#39

Earlier quoted context omitted.

I used to debate this but after learning Rust it’s undeniable.

I thought I wanted static typing until I started writing clojure.

Same here. Clojure offers a bunch of different invariants than ‘this field is a string’. Things like ‘nobody is modifying this complex data structure out from underneath you’ or ‘this complex value is trivially printable, readable, inspectable, comparable, diffable, etc’. And if you want to know for sure that field will be a string, you can spec it and enforce it where it matters. And ignore it where it doesn’t.

Re: Cold Showers

#40
post #8
post #3

Hype: Cold showers are good for you (good stress) Shower: keybored, your shower is not cold enough to induce stress and you are too lazy to modify the showering experience in any way Caveats: Other people may be anti-lazy enough to modify the showering experience Notes: Check yourself

Most Times I can't bring myself to get into a cold shower. If I start warm I can cool down from there. Is there a way to start cold and go even colder?

Anecdotal, but for some reason, when I tell myself "It's just cold water", my fight or flight response instantly goes away.
Post reply on HN