Live data from Hacker News

Learning Go by porting a medium-sized web back end from Python

benhoyt.com

121–130 of 207 posts

Re: Learning Go by porting a medium-sized web back end from Python

#121

I can agree with most of the article, but for some it looks like we have not been using the same language ecosystem at all. Go really feels opinionated around the wrong things, in order to claim "simplicity" as a feature: - No generics just mean you're going to be handing interface{} all the way in your stack, it makes things more complex and less readable for no reason (and less safe) - error handling which is essen…

I agree completely. Go is opinionated about the wrong things, in the wrong way. Which in the end make it a worse language than it could have been.

One thing you did not mention is very varied quality of the standard library. I’m still baffled about ”standard date” crazyness. There are huge warts in the sql interface etc

My collegues used to joke golang is a great solution to google’s problems (for others, not as good as it arguably could have been to put it mildly)

Re: Learning Go by porting a medium-sized web back end from Python

#122
post #7
post #3

Recently I have had the opportunity to write a microservice in Go. It was a very refreshing experience switching from Scala. Go is a lot faster to compile and runs with a far smaller footprint. The channels are nice. On the other hand the testing feels wrong because its so annoying to do mocks. And don't even get me started on the dependency management. Overall Go feels to me like some version compiled PHP with bette…

I really wish that there was a language which had these features: - simple (so not Scala, Haskell, Perl 6, etc.; no Rust either, unfortunately) - clean (nice syntax, preferably Python inspired, but consistent) - modern (generics, some functional features, string interpolation, etc.) - decent concurrency/parallelism story - good IDE, preferably supported by the core dev team - compilation to a (possibly static) native…

I think my dream language would be C# but with a slightly more Pythonesque syntax (significant indentation, no semicolons or braces...). I wonder if a transpiler like that exists.

Re: Learning Go by porting a medium-sized web back end from Python

#123
post #7
post #3

Recently I have had the opportunity to write a microservice in Go. It was a very refreshing experience switching from Scala. Go is a lot faster to compile and runs with a far smaller footprint. The channels are nice. On the other hand the testing feels wrong because its so annoying to do mocks. And don't even get me started on the dependency management. Overall Go feels to me like some version compiled PHP with bette…

I really wish that there was a language which had these features: - simple (so not Scala, Haskell, Perl 6, etc.; no Rust either, unfortunately) - clean (nice syntax, preferably Python inspired, but consistent) - modern (generics, some functional features, string interpolation, etc.) - decent concurrency/parallelism story - good IDE, preferably supported by the core dev team - compilation to a (possibly static) native…

C38 (so when the world ends):

- arrays with slices (that could also be used for strings) and Cilk Plus array notation [1]

- maybe actual string type with separate concatenation operator (possibly space as awk uses and C for literal strings) it could probably be folded to improved arrays

- standard SIMD vector types so that most use for operator overload disappears

- cleaned up standard library

- actual macros so the remaining use for operator overload disappears

- module system (so you would generally not need make and could easily compile to static binary)

- already you can build with static musl libc [2]

- something like libdill [3] or libmill [4] in stdlib

- there are multiple good IDEs, debuggers, analyzers

- one of biggest ecosystems and communities

- historical baggage mostly cleaned up

[1] https://en.wikipedia.org/wiki/Cilk#Array_notation

[2] https://www.musl-libc.org

[3] http://libdill.org/

[4] http://libmill.org/

Re: Learning Go by porting a medium-sized web back end from Python

#124

Earlier quoted context omitted.

Cheers to Nim. I'm learning it in my spare time for fun. However, I will not consider using it for anything more than toy projects until it hits 1.0. Hopefully soon.

> I will not consider using it for anything more than toy projects until it hits 1.0. Hopefully soon. It should happen soon (TM), but from what I understand it will be just another version, just this time renamed to 1.0 - this basically means you could start using it more seriously even now.

Yeah. I understand that it will be just another version with not that many changes. Nim as it currently already feels stable and solid. But, I believe v1.0 release will carry a commitment to not introduce breaking changes at least for reasonable period of time after.

Re: Learning Go by porting a medium-sized web back end from Python

#125
post #116
post #61

Earlier quoted context omitted.

No, the intended way of cloning works by exporting the exact specifications to a text file and re-creating the environment from the text file. If you use packages from conda channels (which are repositories of packages), then it should work flawlessly. Usually basically everything is available from either the official channel (anaconda) or some community channel (like conda-forge). At least in the data-science domain…

> No, the intended way of cloning works by exporting the exact specifications to a text file and re-creating the environment from the text file. Snatching defeat from the jaws of victory :) But I'm not sure who to believe, the other reply to the parent comment says that copying things around is actually possible.

Well, as my edit says, I've had success with installing anaconda on an other machine and copying the environment folder to the proper place inside the installation, but AFAIK that's not an officially supported way of doing it.

Re: Learning Go by porting a medium-sized web back end from Python

#126
post #63
post #39

What I've noticed, and personally experienced, about these porting projects is that they're generally a premature optimization but are a great way to learn a new language. The gains from a port are largely intrinsic in nature, residing with the programmers. However, systems and operations largely carry on just fine with the original language chosen. Only one story comes to mind where a programmer had a legitimate pro…

Writing in a fast compiled language is not premature optimization. Premature optimization would be something that makes the code more complicated and more difficult to follow but produce better performance. Writing the same code in a fast compiled language is just the default thing that you should be doing when you are not doing premature optimization. Writing in a slow interpreted language is more like premature "de…

I don't follow this logic. Why not use C all the time by default then?

Re: Learning Go by porting a medium-sized web back end from Python

#127
post #97

Earlier quoted context omitted.

Developers have the gain, company suffers, developers move on for higher salary with more skills, CTO is in it, doesn't fullfil his duty towards the company or investors, CEO has no clue and doesn't manage the CTO. The story I see over and over again as a startup CEO consultant.

Hell, I've seen this as a lead/senior engineer. I'm seeing it right now, in fact, as a person on our team wants to write some stuff in language X, which nobody else on the team has experience with, and which isn't used anywhere else in the company, and to solve a problem that is perfectly well solved (in both development time and performance) with the language and tooling we already use. As far as I can tell this eng…

I'm a senior engineer and I'm also the person that wants to use the shiny new thing.

I'm just learning Go and I'm itching to find a project to use it on. It's super hard to justify it though when C# or Python would work just as well and those are languages that we already use.

Re: Learning Go by porting a medium-sized web back end from Python

#128
post #7
post #3

Recently I have had the opportunity to write a microservice in Go. It was a very refreshing experience switching from Scala. Go is a lot faster to compile and runs with a far smaller footprint. The channels are nice. On the other hand the testing feels wrong because its so annoying to do mocks. And don't even get me started on the dependency management. Overall Go feels to me like some version compiled PHP with bette…

I really wish that there was a language which had these features: - simple (so not Scala, Haskell, Perl 6, etc.; no Rust either, unfortunately) - clean (nice syntax, preferably Python inspired, but consistent) - modern (generics, some functional features, string interpolation, etc.) - decent concurrency/parallelism story - good IDE, preferably supported by the core dev team - compilation to a (possibly static) native…

seems like Go 2 has a good chance of being this (at least if you consider its syntax clean, which I do).

basically go is missing from your list is generics and string interpolation.

Re: Learning Go by porting a medium-sized web back end from Python

#129
post #105

Earlier quoted context omitted.

[deleted]

"io.Reader is literally an interface{} though. I think what you're referring to is the other packages that define their own Reader's, ie using structs with methods, those are referred to as interfaces despite not literally being an interface{}." That appears to be a definition unique to you that I have never seen from anyone else before, including the Go designers. io.Reader is an interface, no braces. Its full expan…

This is correct. I think part of what you're saying, in fewer words, is that there are interface method signatures, and there are interface expressions, which are ultimately different.

Re: Learning Go by porting a medium-sized web back end from Python

#130
post #64

Earlier quoted context omitted.

Using a compiled language is not a premature optimization if you're not sacrificing expressiveness. With that said, Go is not the best choice. Like, for anything.

What would you choose instead?

OP was saying porting a project to Go sounds like premature optimization. The alternative is obviously to continue to use the original language.

The question to be answered is why are you porting it? Fun and giggles? Hoping to achieve better performance? Scale? Portability? Correctness? Simplicity? Support?

I'd say most of the time its for fun and giggles. Which I think is as fine a reason as all the others, but when its costing someone's elses money, maybe you should be more considerate.

Post reply on HN