Live data from Hacker News

On the Impact of Programming Languages on Code Quality

arxiv.org

61–70 of 138 posts

Re: On the Impact of Programming Languages on Code Quality

#61

Earlier quoted context omitted.

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

PHP? C?

Always remember to turn on warnings in PHP. I remember the joys of tracking down a mistyped variable name that PHP just instantiated and gave a null value to, which was then implicitly converted to empty string when the variable was used.

Re: On the Impact of Programming Languages on Code Quality

#62
post #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.

Definitely. Heck, in .NET's early days, there was a distinct difference in quality of the software and of the team using VB.net vs C#, when they were 99% the same language (they had some features unique to each, but they were very few). But C# was used a lot in new projects or by people familiar with Java while VB.net was used in VB6 migrations or teams coming from VB6. That had a drastic effect on the end result, but the language had very little to do with it.

Re: On the Impact of Programming Languages on Code Quality

#63

Earlier quoted context omitted.

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

PHP? C?

Last time I worked with those languages was in college 10 years ago so I didn't know portion of shooting myself in the foot was my fault versus the language.

Re: On the Impact of Programming Languages on Code Quality

#64
post #37
post #6

(Edited-- I was reading the original paper, which showed good results for TypeScript; the new paper linked above refutes that result. My mistake. Thanks to the posters who corrected me!) The winners in this paper are Clojure, Haskell, Scala. I look forward to seeing Rust added. The authors go into substantial detail about what they consider errors, and in my personal experience Rust solves many of them. See e.g. "Som…

Scala will really start to shine only after Scala Native[1][2] is ready. [1] http://www.scala-native.org [2] https://github.com/scala-native/scala-native

What features of Scala Native do you think will improve Scala code quality?

Re: On the Impact of Programming Languages on Code Quality

#65
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…

I think you're making the same confusion a lot of other commenters have made, specifically responding to the original study as opposed to this failed replication of that study: https://news.ycombinator.com/item?id=20105150

Re: On the Impact of Programming Languages on Code Quality

#66

Earlier quoted context omitted.

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

PHP? C?

I agree that JS is not substantially "worse" than some other languages.

Despite these three languages giving far too much freedom to the programmers (which some might even like), high-quality code can be written in all three of them, as long as intelligent and strict coding guidelines are thoroughly followed.

Re: On the Impact of Programming Languages on Code Quality

#67
post #42

Earlier quoted context omitted.

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.

I thrive on checklists and hate the ad-hoc way I do code reviews on my team. This sounds great, I'm going to go look for some basic formal checklists. I need language agnostic versions and/or versions for javascript, php, and python, if anyone has suggestions.

Re: On the Impact of Programming Languages on Code Quality

#68

Earlier quoted context omitted.

PHP? C?

I agree that JS is not substantially "worse" than some other languages. Despite these three languages giving far too much freedom to the programmers (which some might even like), high-quality code can be written in all three of them, as long as intelligent and strict coding guidelines are thoroughly followed.

I always think of languages as a solution space, and some points in the space possessing bugs while others don't. A perfect language(impossible) would make it so you could write any correct version of a program in the language but not any incorrect version. And language constraints like static typing have the disadvantage that you're preventing a bunch of correct possible solutions while closing off incorrect solutions. Ideally closing off many more incorrect solutions than correct ones increasing your chance of landing in a correction solution.

And of course lots of out of band(non-language) processes and tools that influence this like unit testing/code reviews/strict coding guidelines. But it's always nicer when it's prevented at the language level as opposed to out of band.

Re: On the Impact of Programming Languages on Code Quality

#69
post #37
post #6

(Edited-- I was reading the original paper, which showed good results for TypeScript; the new paper linked above refutes that result. My mistake. Thanks to the posters who corrected me!) The winners in this paper are Clojure, Haskell, Scala. I look forward to seeing Rust added. The authors go into substantial detail about what they consider errors, and in my personal experience Rust solves many of them. See e.g. "Som…

Scala will really start to shine only after Scala Native[1][2] is ready. [1] http://www.scala-native.org [2] https://github.com/scala-native/scala-native

Looks great, but will that happen in our lifetime?

Re: On the Impact of Programming Languages on Code Quality

#70
post #35

I’ve read a lot of code as a consultant. The best codebase I’ve read had almost no comments and was written in erlang. Besides that every codebase I’ve read in Golang were super clear and of excellent quality for the exception of one that was written by java developers. I can say I hated reading C because of maccros and different build systems. I hated C++ codebases because people abused generics. And I hated Java th…

> because of the verbosity and the directory structure and all the layers of abstractions and all the factories and all the singletons and all the Fair, but a lot of those abstractions make life more difficult for new programmers (Why do I have to look through 12 classes to find out what this button does?), but make life much easier when you know the code base and have to maintain and extend it. Or, legit question -…

> is Java more prone to these types of issues due to its design?

Yes. Except on the actively powerless languages (mostly C and Go), people write code on other languages with the same flexibility that all that indirection creates on Java, but they use much simpler structures.

Post reply on HN