Better HN
topnewbestaskshowjobs
Log inSign up

ReflectedImage

476 karma · joined May 12, 2020 (6y ago) · 570 submissions

Submissions

comment 3y ago · link · parent

Here: https://games.greggman.com/game/dynamic-typing-static-typing...

I think it's more effective to show that there is no evidence to contradict me first.

comment 3y ago · link · parent

Here's a citation if it makes you happy: https://games.greggman.com/game/dynamic-typing-static-typing...

2% of bugs can be caught via static typing.

For your very simple example, your IDE can do that!

comment 3y ago · link · parent

https://games.greggman.com/game/dynamic-typing-static-typing...

comment 3y ago · link · parent

Well a lot of people are claiming that static typing reduces bugs compared to dynamic typing, but I haven't seen from them a shred of evidence of this.

When I go looking for myself what I found was studies saying that dynamic typing reduces development time by 2.5x and bugs per software feature by 2.5x.

So perhaps one of these people claiming that static typing reduces bugs over dynamic typing, could provide the slightest bit of evidence to backup their claims?

Is that too much to ask @spoils19?

But I'm pretty sure they will just find the exact same figures as me.

comment 3y ago · link · parent

Large Python projects are done with microservices typically.

comment 3y ago · link · parent

I disagree, it makes things more complicated by bringing in concepts such as generics.

Using MyPy will on average double your bug count per software feature. You might not think it does that. But if you actually go and measure it, the bugs go through the roof. There are studies on this. It's for subtle reasons revolving around where bugs come from in code.

comment 3y ago · link · parent

You quit Python because you tried to use static typing in a dynamic language and for obvious reasons that doesn't work.

You could have introduced an UAT environment and done basic QA.

comment 3y ago · link · parent

No programming language tells you if a program is correct at compile time. Type errors aren't a very common type of bug either.

comment 3y ago · link · parent

I'm not convinced they are different. Take a large program and break it down into smaller programs with a singular purpose.

comment 3y ago · link · parent

Once you have got 5 years real world experience and find programs in production that work for the wrong reasons, you will understand. (And I'm not just talking about programs with dynamic typing either)

I'm aware of one case where a program traded 10 million dollars, made 5 million profit. There was a serious jaw dropping error in it. Did it matter? (and if so, to whom?)

comment 3y ago · link · parent

https://games.greggman.com/game/dynamic-typing-static-typing...

comment 3y ago · link · parent

League of Legends Build Generator: https://www.lolsolved.gg It's generic algorithm based.

comment 3y ago · link · parent

Actual measurements.

I don't think you should be surprised. Untyped Python code is a lot shorter and more concise than typed Python code.

The easiest way by far to reduce the bug count is to reduce the lines of code.

comment 3y ago · link · parent

I don't actually care about any of that stuff. You are confusing technically wrong with not working. If the code works in production it doesn't matter that the code is technically wrong.

Testing via typing is very weak testing. Almost worthless. Type checking doesn't find many bugs in general.

Strongly typed languages have 2.5 times the number of bugs as dynamically typed languages per software feature.

Why would you intentationally add bugs to your code?

It doesn't make any sense to me.

Thinking using static typing in a scripting language is a good idea is pretty naive. It's like creating a version of Haskell with mutability.

comment 3y ago · link · parent

No, you really don't. Static typing is very complex and error prone compared to dynamic typing.

There is a lot less stuff that needs remembering.

comment 3y ago · link · parent

Things don't die very often due to typing issues. The unit tests always pick up typing problems.

Testing the code's behavior implies testing the code's typing. And if you are not testing the code's behavior then the code isn't really tested at all.

comment 3y ago · link · parent

Typed Python code on average takes two times the time to develop and contains two times the number of bugs per delivered software feature.

It's bad, really really bad.

Refactoring can be done just as well via a good IDE and unit testing.

Using typechecking creates far more errors then it finds. They are a necessary evil in compiled languages. It's been measured that it creates more errors. That is not open for debate.

comment 3y ago · link · parent

Lack of typing support is a major advantage. If you don't have types you don't need interfaces, generics, etc. The resulting code is shorter and less bug prone.
1
101112
19