Live data from Hacker News

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

benhoyt.com

201–207 of 207 posts

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

#201
post #9
post #7

Earlier quoted context omitted.

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…

A lot of people I know are bailing on .net because it doesn’t live up to the promises. Everyone else gets the cool stuff first, the vendor that owns it is a dick and there has been so much schizophrenia over the last few years that it’s a business risk adopting it in case you have to throw your product under a bus again. Go is showing itself to be a good compromise especially with the simplified nature of deployment…

You are pretty much describing my thought process. .NET is comfortable but the cool stuff is happening on other platforms.

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

#202

Earlier quoted context omitted.

Elixir compiles to bytecode which is not half bad

Pretty much everything compiles to bytecode (e.g. Java does, Python does, C# does, …) I expect they want a native binary (possibly even statically linked) so they can trivially distribute the artefact without requiring that the VM be installed or bundled which is a PITA, in which case "compiles to bytecode" is useless.

sorry, i should have said compiles to a bytecode that's not half bad

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

#203
post #97

Earlier quoted context omitted.

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…

But this also might be a problem of a company not providing any improvement / career prospects for your programmers. If working as a programmer means sticking to C# or Visual Basic or Python codebase and just working on adding new features or new business logic to your application for years and years, many engineers will not find that fulfilling. The best engineers will always want to learn about new tech and approac…

This has nothing to do with whether engineering is a "cost center" or not. It's about fundamentally what is important about the practice of engineering. Whether to use Python or Go or Java or Rust or whatever is rarely anything other than bike shedding. In those cases where it's not, the key problems are rarely which language is technically better: more often the problems are associated with labor supply and how well the proposed language' ecosystem plays with existing implementations'.

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

#204
post #193
post #191

Earlier quoted context omitted.

> Are you serious? Python code is about 10 times slower than equivalent code in Go. And 98% of the time it doesn't matter. For most business problems that you'd want to solve with a computer, for modern hardware, Python's performance is more than adequate. It's really not worth worrying about.

No. This is only true if you have a script you run once an hour or so. If you have a server side application that you hope to be successful then the code will be running all the time and you will pay the price literally because cloud hosting services charge for CPU and RAM usage, which will be off the charts if your server is in Python. Not to mention all the time you will spend firefighting the performance issues th…

> If you have a server side application that you hope to be successful then the code will be running all the time and you will pay the price literally because cloud hosting services charge for CPU and RAM usage, which will be off the charts if your server is in Python.

Your hosting fees are a tiny fraction of your expenses. Development time is worth a lot more.

> Not to mention all the time you will spend firefighting the performance issues that will inevitably arise. Which also literally costs money in terms of developer salaries and opportunity cost (you can't spend that time to develop new features).

Scaling is a nice problem to have. If you get to the point where you actually need to improve performance, you'll be able to afford to spend time on it.

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

#205
post #23

Earlier quoted context omitted.

>- 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) Depends on what you do. I've written a good chunk of go code and interface{} is the rare exception rather than the rule, usually employed where a user might supply arbitrary types (ie a unmarshaljson like function) But if you do a website or webapp, 99…

> But if you do a website or webapp, 99% of your code is not using interface{} in it's methods. How do you deal with the lack of sets and trees? I believe those two data structures are frequently almost indispensable - even in the most boring mostly-CRUD web projects. And it's either type assertions on {}interfaces or go-generate based specialized implementations. Both feel odd to me. (Am I missing something?)

For Sets, you can get away with the language slices and maps, which work sufficiently well.

I haven't found a need for trees in most of my projects and where I did I implemented it when necessary.

You can however, if you need to, separate the code and data of a tree by using a data adapter. The tree only stores a unique ID for an object which you can receive using the adapter, which would be a simple map or slice.

But as mentioned, I very very rarely needed them and not yet in any CRUD web project.

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

#206
post #79

Earlier quoted context omitted.

> Developers learn a new language that is faster to develop, safer and faster to run than existing solutions Would that it was that simple. Most of the time I've seen this it's been more like “writing new code is fun, fixing a bad design in our current code is too much like work” without factoring in the cost of rewriting, testing, optimizing all of the code which wasn't a problem relative to simply replacing the hot…

I understand the situations you are describing and I still have the impression that the main problem behind this is inadequate leadership (and probably at several layers...). There are more than enough Real Programmers or lacking soft eng who are not experienced or knowledgeable enough to know when to use C/python/go/sql/etc but again for me the problem is either whover hired them and whoever is managing them. I also…

I agree that the main problem is leadership — and arguably mentorship as well. As a field we're too predisposed to view all problems as technical and ignore the social factors which lead to the visible technical symptoms.

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

#207
post #204
post #193

Earlier quoted context omitted.

No. This is only true if you have a script you run once an hour or so. If you have a server side application that you hope to be successful then the code will be running all the time and you will pay the price literally because cloud hosting services charge for CPU and RAM usage, which will be off the charts if your server is in Python. Not to mention all the time you will spend firefighting the performance issues th…

> If you have a server side application that you hope to be successful then the code will be running all the time and you will pay the price literally because cloud hosting services charge for CPU and RAM usage, which will be off the charts if your server is in Python. Your hosting fees are a tiny fraction of your expenses. Development time is worth a lot more. > Not to mention all the time you will spend firefightin…

> Your hosting fees are a tiny fraction of your expenses.

Only when your requirements are low.

Things get very expensive when you start requiring real performance.

> Scaling is a nice problem to have. If you get to the point where you actually need to improve performance, you'll be able to afford to spend time on it.

You don't know that. If you're a startup, it's very likely that you're still not profitable at that point.

Post reply on HN