Live data from Hacker News

On the Impact of Programming Languages on Code Quality

arxiv.org

41–50 of 138 posts

Re: On the Impact of Programming Languages on Code Quality

#41

Earlier quoted context omitted.

That is always a risk if a team decides to pick up a new language but does not make the effort to learn the language properly. At work we are going through a similar Java - Go transition, so I know :(

It's always a problem when people shoe-horn a non-idiomatic approach from one language into another. It makes me wish the language creators wrote a single none-trivial 'this is how we intended it to look' project. When learning a new language I find as many big projects written in it as I can and spend time exploring them. It helps but there is often no guarantee those projects are doing it idiomatically either.

Looking through the Python standard library or Go standard library should be a clue not to use Java idioms, but yes I realize those habits are hard to break. I have seen Java-in-Python and it is indeed painful.

Re: On the Impact of Programming Languages on Code Quality

#42
post #23

A common thread I'm seeing in the discussion here is confusing the claims from the original paper with conclusions made by this paper . This is a replication study, and it starts by stating what the original paper found. What the original paper found is not what this paper finds. For the most part, this is a replication failure, for a myriad of reasons, including several kinds of misclassification. From this paper: T…

Yes, definitely. This is mostly a non-replication of the original study. I was a little disappointed that they didn't look at defects per line of code, even though that's already a fairly well-studied metric. I think the lesson here is that you can write good or bad code in any language, but choose one that's fit for purpose. Using proper abstractions (including those builtin to languages) probably does more to reduc…

The practice that most reduces the incidence of tests is code review: https://kevin.burke.dev/kevin/the-best-ways-to-find-bugs-in-...

Re: On the Impact of Programming Languages on Code Quality

#43
post #41

Earlier quoted context omitted.

It's always a problem when people shoe-horn a non-idiomatic approach from one language into another. It makes me wish the language creators wrote a single none-trivial 'this is how we intended it to look' project. When learning a new language I find as many big projects written in it as I can and spend time exploring them. It helps but there is often no guarantee those projects are doing it idiomatically either.

Looking through the Python standard library or Go standard library should be a clue not to use Java idioms, but yes I realize those habits are hard to break. I have seen Java-in-Python and it is indeed painful.

The problem with reading framework and library code is that it's very coupled to what it is, so while it's interesting and valuable to read it's not really the type of code you'd see in a business app or whatever.

Re: On the Impact of Programming Languages on Code Quality

#44

Of note is that these are all associations. It's possible the associations are all due to selection effects (or even that the "better" language are actually worse but their effects are reversed by selecting for programmers who are better). In the early days of Python, some employers used it as a way to filter for candidates who were ahead of the curve. I believe Paul Graham mentioned Lisp being good for attracting be…

In an infamous rant, Linus Torvalds also hints at using a language as a filter for programmers[1]: >Quite frankly, even if the choice of C were to do nothing but keep the C++ programmers out, that in itself would be a huge reason to use C [1] http://harmful.cat-v.org/software/c++/linus

and yet here we are in 2019 where linus happily contributes to a C++ codebase (https://github.com/Subsurface-divelog/subsurface)

Re: On the Impact of Programming Languages on Code Quality

#45

My own take of this: - This study tries to enhance the original work by better metrics (e.g. confusion with C/C++), using better statistics (e.g. uncertainty). - Automatically evaluating the quality of a code is hard and time-consuming. They had to use peer review of labellisation. - Most of the old claims are not confirmed. - Only 2 languages in this study had both a significant impact (impact coeff) and enough fiab…

> - Only 2 languages in this study had both a significant impact (impact coeff) and enough fiability (p-value): Clojure and Haskell. But the impact is still small, and there may be other influencing factors.

They also found a significant positive association between C++ and bug.

Re: On the Impact of Programming Languages on Code Quality

#46
Seems like they're just doing associations, and not controlling for a lot of factors. For example, you can come up with some narratives to explain a lot of these findings:

* Python, JS, PHP, Java, C++ are all very common first languages; I'd imagine the average experience level for these is dragged down a bit compared to others like Golang, Haskell, or Scala. One of the recent Stack Overflow Developer surveys found Golang use to be strongly correlated with age, and since I'm assuming bug count would negatively correlate with age you'd see a confounding factor here.

* Ruby's community has an obsessive culture towards unit testing, that could impact bug levels.

* The trade-offs that make C and C++ attractive such as memory performance are double-edged swords and will naturally correlate with more bugs. For example, I work a fair bit in embedded systems which use MISRA C out of necessity; I've also worked in large scale data processing which chooses C++ for its memory mapping performance over Java or Go. If "number of defects" is your primary measure then you're ignoring some of the reasons languages are chosen. Sometimes a language that minimizes bugs is not a viable option.

* I'd guess there is a skill correlation here: an engineer who is willing to seek out a specific less-used language and learn to use it effectively is probably more likely (not guaranteed) to do a better job than one who is just going with the default choice.

It'd be very interesting to see a regression done that accounts for these factors.

Re: On the Impact of Programming Languages on Code Quality

#47
post #46

Seems like they're just doing associations, and not controlling for a lot of factors. For example, you can come up with some narratives to explain a lot of these findings: * Python, JS, PHP, Java, C++ are all very common first languages; I'd imagine the average experience level for these is dragged down a bit compared to others like Golang, Haskell, or Scala. One of the recent Stack Overflow Developer surveys found G…

That would be interesting. I also have a feeling it would be incredibly difficult to accurately control for social differences in language communities.

Re: On the Impact of Programming Languages on Code Quality

#48
post #46

Seems like they're just doing associations, and not controlling for a lot of factors. For example, you can come up with some narratives to explain a lot of these findings: * Python, JS, PHP, Java, C++ are all very common first languages; I'd imagine the average experience level for these is dragged down a bit compared to others like Golang, Haskell, or Scala. One of the recent Stack Overflow Developer surveys found G…

JS also has more ways to shoot yourself in the foot than any other language I've worked with.

Re: On the Impact of Programming Languages on Code Quality

#49
post #42

Earlier quoted context omitted.

Yes, definitely. This is mostly a non-replication of the original study. I was a little disappointed that they didn't look at defects per line of code, even though that's already a fairly well-studied metric. I think the lesson here is that you can write good or bad code in any language, but choose one that's fit for purpose. Using proper abstractions (including those builtin to languages) probably does more to reduc…

The practice that most reduces the incidence of tests is code review: https://kevin.burke.dev/kevin/the-best-ways-to-find-bugs-in-...

Emphasis on "Formal code review" which is practiced in far fewer shops than "code review".

For those who don't happen to know the difference, formal code review basically uses a check list of common best practices and possible defects to look for versus doing each code review ad-hoc.

Re: On the Impact of Programming Languages on Code Quality

#50

My own take of this: - This study tries to enhance the original work by better metrics (e.g. confusion with C/C++), using better statistics (e.g. uncertainty). - Automatically evaluating the quality of a code is hard and time-consuming. They had to use peer review of labellisation. - Most of the old claims are not confirmed. - Only 2 languages in this study had both a significant impact (impact coeff) and enough fiab…

And should be weighed against of the difficulty of trying to staff a team full of Haskell developers :).
Post reply on HN