Live data from Hacker News

Cold Showers

github.com

81–90 of 363 posts

Re: Cold Showers

#81

Earlier quoted context omitted.

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…

A lot of the studies have been problematic because they look at toy problems (like leetcode problems). Static typing really starts to show its value in large projects. One huge project I'm aware of that uses a lot of python is the Sims 4 which uses it for a lot of the game engine and mods.

Your argument is analogous to the one used by homeopaths and those believing in telekinesis. "There is an effect but it disappears in a laboratory setting, but it's still there!"

Re: Cold Showers

#82

>Hype: "Static Typing reduces bugs." Oof, that one is a huge can of worms.

Yeah, having worked with both typed and untyped languages (and on teams that have transitioned between these) it is hard to reconcile.

There are so many variables involved that I see this being difficult to prove empirically, but anecdotally it doesn't ring true.

Re: Cold Showers

#83

Earlier quoted context omitted.

Until the types don't match the execution model... see: python type hints

That isn’t static typing That’s a dynamic typed language with comments

They can be consumed by static analysis tooling, which assuming properly configured etc. makes it sort of 'dynamically typed language with the guarantees of a statically typed one', at least so far as the hints are complete.

Re: Cold Showers

#84
For me the biggest advantage of static typing is that it allows to safely refactor code. Without it even with extensive unit test coverage refactoring often is just not an option.

Re: Cold Showers

#85
post #70

Earlier quoted context omitted.

that it aids my understanding and helps in navigating the program Static typing reduces bugs because it aids your understanding.

Not necessarily. This increased ease of understanding could also simply result in faster development speed - so same number of bugs, but more features in less time. Not sure though.

So fewer bugs per feature. Assuming that the total number of features required is the same either way, by the end you're still left with fewer bugs.

Re: Cold Showers

#86
post #75

> Benchmarking cutting-edge graph-processing algorithms running on 128-core clusters against a single-threaded 2014 Macbook Pro. The laptop consistently wins, sometimes by an order of magnitude. LOL, this hits close to home. My company had a modeling specific VM set up to run our predictive modeling pipelines. Typical pipeline is about 50,000 to 5 million rows of training data. At best, using an expensive VM, we mana…

There appear to be slightly weird commercial reasons behind this, because gaming GPUs have great CUDA performance but NVIDIA won’t let you put them in a datacentre. So buying your data scientists gaming laptops (RGB and all) generally works out faster for any reasonable price point. That said, a dedicated server with a decent Xeon and MKL set up correctly generally outperforms CPU-bound stuff.

I think it really depends on your data size. All the benchmarks I can find are on massive datasets, with tens of millions of rows or thousands of columns. I’m sure there are significant performance gains in these situations. Our data just wasn’t big enough.

Re: Cold Showers

#87
Was hoping to see, and would like to see, one of these on Functional Programming.

It’s been an immensely enjoyable experience getting into it, but with a non trivial startup cost.

My team has generally adopted it (at least to some degree, and in a language which half supports these patterns), but I’m sure this coding style erodes in favor of something that feels more imperative when we move on.

Re: Cold Showers

#88
post #77
post #62

Earlier quoted context omitted.

It’s basically self-evident that static analysis reduces bugs. It’s trivial to construct an example of where type information would catch a bug. Unless there is some reason that including type information increases bugs, the existence of a single example where type information catches a bug would prove that overall type information reduces total bug count.

One could argue that dynamically typed code is often shorter, and therefore both easier to reason about, and possessed of fewer bugs on a bugs-per-line basis. Not really keen to push that line of reasoning myself, just helping picture one possible argument.

This is true in a local context, but entirely breaks down when a codebase becomes larger than a single person can fit into their brain-RAM. Not arguing or saying you're wrong - just presenting the very quickly reached boundary where the argument breaks down.

Re: Cold Showers

#89

>Hype: "Static Typing reduces bugs." Oof, that one is a huge can of worms.

Static typing makes refactoring easier. Your compiler can instantly tell you what you've broken. Bugs are reduced by monitoring, testing, and reducing how much code there is so there's less surface area (which also makes monitoring and testing easier). You reduce code by refactoring.

> Your compiler can instantly tell you what you've broken.

For some definition of "instant".

I can often run my Python or JavaScript test suite faster than Haskell/GHC or Rust/rustc can type-check a module.

And it can take a while to understand Haskell, Rust, or C++ error reports.

(Of course, Python and JavaScript startup time and execution speed can hurt refactoring too. And AttributeError-s and random undefined-s aren't always easy to debug.)

Re: Cold Showers

#90

>Hype: "Static Typing reduces bugs." Oof, that one is a huge can of worms.

Static typing makes refactoring easier. Your compiler can instantly tell you what you've broken. Bugs are reduced by monitoring, testing, and reducing how much code there is so there's less surface area (which also makes monitoring and testing easier). You reduce code by refactoring.

> Bugs are reduced by monitoring, testing, and reducing how much code there is so there's less surface area (which also makes monitoring and testing easier). > > You reduce code by refactoring.

This is a great point.

I wonder if there's a study on bugs-per-line-of-code, how this changes across project sizes, and whether refactoring changes bugs-per-line-of-code.

Post reply on HN