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.
Cold Showers
81–90 of 363 posts
Re: Cold Showers
#82>Hype: "Static Typing reduces bugs." Oof, that one is a huge can of worms.
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
#83Earlier 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
Re: Cold Showers
#84Re: Cold Showers
#85Earlier 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.
Re: Cold Showers
#86> 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.
Re: Cold Showers
#87It’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
#88Earlier 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.
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.
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.
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.