Live data from Hacker News

Python Is Easy. Go Is Simple. Simple != Easy

preslav.me

311–313 of 313 posts

Re: Python Is Easy. Go Is Simple. Simple != Easy

#311
post #308

Earlier quoted context omitted.

I read a lot of code. Reading Go is painful because I have to parse whatever open-coded version of standard algorithms or error handling the developer chose to use that day.

I used to read code for a living (security consultant) and I'll ask you this question: you're being thrown in a codebase and you need to understand it in a week, what code do you wish the codebase to be. I'll give you the answer: it's going to be the language you work in, and then Golang if it's not the language you work in.

This is actually a pretty interesting question; hard disagree on Go though. I work in security but I don't do much formal code review, instead I care more about trying to figure out how things work as fast as possible. Go is easy to "parse" in that the language isn't too complicated but navigating the architecture of complex projects is annoying because there is just so much boilerplate everywhere that I have to cut through. It's kind of like how I feel with Java, despite it being one of my strongest languages. Otherwise I actually do know a fair number of languages well enough to comfortably navigate around projects that use them; I think C and JavaScript projects are generally not too bad, C++ can be pleasant or painful depending on how things are structured, and Python is also a toss-up. Rust, Swift, Scala, Kotlin are usually pretty good. Of the languages I really don't know I think I would rank Ruby as one of the worst, maybe TypeScript on the better side?

Re: Python Is Easy. Go Is Simple. Simple != Easy

#312

Earlier quoted context omitted.

Ironically, we had more advanced languages than Go in the 70s.

Yeah, but advanced languages are also a problem for long-term maintainability. Remember, Go was developed at Google - jokingly, while waiting for stuff to compile. They deal with tens of millions of lines of C++ written by thousands of engineers with varying skill levels and career paths. The advancedness of C++ did not reduce the compile times or readability of the code. At those scales you can't rely on being famil…

Advanced languages can compile quickly - it depends on the feature set chosen. For example, do-notation is an advanced feature not found in most languages, but it compiles quickly as it is syntactic sugar. Operator overload, on the other hand, might require a solver and thus compile slower. It's not a particularly advanced feature, however. Binary optimization passes do not make the language any more advanced (on the user side), but will slow down compilation. Advanced design and compile-times are pretty orthogonal.

As for maintainability, it's not clear to me that reams of imperative code is easier to maintain than something terse and declarative. In fact, probably the opposite.

Re: Python Is Easy. Go Is Simple. Simple != Easy

#313
post #303

Earlier quoted context omitted.

My experience translating a codebase from Python to Golang (chat application), is that 20k of Python really does translate to around 40k of Golang to get the same functionality. And it’s not just due to language but also expressiveness of the library ecosystem.

I very much doubt that. "The man barrier to translation was that, while at 14KLOC of Python reposurgeon was not especially large, the code is very dense. It’s a DSL that’s a structure editor for attributed DAGs — algorithmically complex, bristling with graph theory, FSMs, parsing, tricky data structures, two robot harnesses driving other tools, and three different operator-composition algebras. It became 21KLOC of Go…

It’s not a subjective opinion: I’m saying that I’ve actually migrated a Python application to Golang (real time chat application with a lot of business logic) and it was 2x the line count.

I expect the Golang line count ‘overhead’ gets bigger for typical LoB software that has to address any sort of enterprise mess.

Post reply on HN