Live data from Hacker News

Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

thume.ca

181–190 of 384 posts

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#182

I think the big big result from this study is: "Python: half the size !". A dynamic language like Python is better here, 2x better. I assume similar results would apply to other dynamic languages like JavaScript, Lisp, Smalltalk, Groovy etc. This does not say that static typing should not be used but I think it shows unequivocally that there is a considerable extra development cost associated with static typing. You…

I enjoy hacking in dynamic languages as much as the next programmer. But, the big take-away is that "the initial implementation was done in 1/2 the code" not that the resulting code was more extensible or maintainable (by other programmers!). > You might say that surely that additional cost would be compensated in reducing the cost of maintenance later. Maybe but I'm not sure. I am sure. 100%. From many years of expe…

Lately I've been doing a lot of greenfield development in Python, developing libs for in house use at my employer. We're using 3.7 currently, and I've fully embraced type hints. With proper type hints and use of pylint, you get the static checking that you'd otherwise miss. Bonus, if you're using an IDE like PyCharm, VS code or visual studio, you usually get the linting for free either as you type or on save.

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#183

Earlier quoted context omitted.

That is all true. At the same time here the groups were allowed to use the language of their choice. Presumably they chose languages they felt they were competent in. Of course an expert of a given programming language can write much better in it than a novice. But a comparison like this is not necessarily about comparing top-programmers in every language, but average programmers, because we want to know results that…

There were people with 2k to 10k loc of experience in some language. That seems extremely low for any meaningful comparison and I would really hope that “average” programmers have way more experience than that... I think I was pretty junior after writing north of 100k loc and working on 1M loc projects. And for sure I don’t consider myself highly competent in F# after writing some thousands lines. I agree with the co…

> There were people with 2k to 10k loc of experience in some language. That seems extremely low for any meaningful comparison ...

It's low if you're comparing languages based on the skills of experienced programmers, but most programmers are not terribly experienced. A comparison of languages by programmers that are novices to the language is still meaningful. A language that is easier for a novice to pick up and write good code is at the very least one good measure for the quality of the language.

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#184

Another big takeaway is the reusability of integration tests. Write once, verify implementations in any language. Static or dynamic typing doesn't matter that much if you can verify your software, and there are many different reasons to choose a particular programming language.

You need to look at the whole picture, time taken from day one to release, performance/correctness, then maintenance/onboarding, how easy is it to refactor/add features etc? It's virtually impossible to definatelly conclude in absolute terms that one language is superior than other.

One of my best experiences was dovetailing that happened on a project that had to be c or c++ where I prototyped fully working system in ruby first, then rewritten it in c. Everything went almost too smoothly.

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#185

Another big takeaway is the reusability of integration tests. Write once, verify implementations in any language. Static or dynamic typing doesn't matter that much if you can verify your software, and there are many different reasons to choose a particular programming language.

Well, "[t]esting shows the presence, not the absence of bugs" (Djikstra).

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#186

Earlier quoted context omitted.

I enjoy hacking in dynamic languages as much as the next programmer. But, the big take-away is that "the initial implementation was done in 1/2 the code" not that the resulting code was more extensible or maintainable (by other programmers!). > You might say that surely that additional cost would be compensated in reducing the cost of maintenance later. Maybe but I'm not sure. I am sure. 100%. From many years of expe…

Lately I've been doing a lot of greenfield development in Python, developing libs for in house use at my employer. We're using 3.7 currently, and I've fully embraced type hints. With proper type hints and use of pylint, you get the static checking that you'd otherwise miss. Bonus, if you're using an IDE like PyCharm, VS code or visual studio, you usually get the linting for free either as you type or on save.

I very much agree. Type hinting for everything into and out of a function, and you're in pretty good shape.

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#187
post #148

Earlier quoted context omitted.

That is a good point worth emphasizing. It is well-known that teams cause overhead. Think of the Mythical Man-Moth. But in the end the other teams had 3 people that were able to maintain and develop their project further, if needed. The single-person team had only one such person.

But the Python code was also smaller. Easier to learn and maintain.

"Smaller code" does not mean easier to understand. It just means less characters to read. Maybe those characters are heavily loaded with meaning, as in the case with meta programing. You might need twice as much time to _understand_ the Python Code vs. the Rust code. The Rust code might be easier to extend, etc. So this is all comes to trade-offs at the end. All this being said, I'm still a huge Python enthusiast.

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#188
post #72

Earlier quoted context omitted.

That is all true. At the same time here the groups were allowed to use the language of their choice. Presumably they chose languages they felt they were competent in. Of course an expert of a given programming language can write much better in it than a novice. But a comparison like this is not necessarily about comparing top-programmers in every language, but average programmers, because we want to know results that…

The article says that the instructor for the course cautioned against using Haskell because some people overestimated their competency with it. I think it is actually very likely that people would chose a programming language or system for reasons other than how competent they are with it. E.g. to seem "smart" because you wrote your compiler in Haskell, even though you actually have much more experience with Java or…

Sounds like he (edit: or more accurately, the university) has hasn't taught them enough functional programming and Haskell.

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#189

I think the big big result from this study is: "Python: half the size !". A dynamic language like Python is better here, 2x better. I assume similar results would apply to other dynamic languages like JavaScript, Lisp, Smalltalk, Groovy etc. This does not say that static typing should not be used but I think it shows unequivocally that there is a considerable extra development cost associated with static typing. You…

I don't think the reason why these languages are terser is because they are dynamic. Something that always frustrates me to no end is how many older statically types languages barely have a literal syntax.

Literal syntax and stdlib size and APIs. The latter is especially important on iterator and container interfaces. They must fit together well and be composable.

This can be exemplified using Crystal, which is close to Ruby in both terseness and APIs, but statically typed (and with static dispatch).

Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

#190
post #114

Earlier quoted context omitted.

What are relative compile times like? Building Chromium atm, and to be honest I'd be happy if it were written in a trillion lines of BASIC if that would somehow achieve even a 10x build time speedup.

For chromium, the most important concern will be runtime speed, more than compile time

That, and most people who are compiling it are chromium developers, who will be using dirty builds and so have relatively quick compiles.
Post reply on HN