Live data from Hacker News

Learning Go as a Node.js Developer

nemethgergely.com

71–80 of 82 posts

Re: Learning Go as a Node.js Developer

#71

So I am trying to move away from NodeJs for my next project and I can't decide between Elixir and Go. Can't decide what to choose, any idea if there is any advantage for a noob to learn one or the other?

I don’t see why you move away from Node unless it was for a JAVA spring boot or .net core, especially now that node has actually begun to enter real world usage and enterprise on a large scale. Then again I would have said something similar about picking up Node in the earlier days, so who knows. I doubt Go and Ekixir will ever gain the same reach Node has though. Node has the advantage of JavaScript being an unavoid…

>especially now that node has actually begun to enter real world usage and enterprise on a large scale.

That's why i'm starting to avoid as much as possible all new/updated online services for serious stuff.

Re: Learning Go as a Node.js Developer

#72

Is there really anything else in Go than "pretty good standard library". Looking at this and many other Go discussion it seems there isn't. I've been using Go for a while now and while standard library is ok and definitely better than the one in Node.js and I really like strong typing, I still have to say Go is probably one of the worst programming languages I have ever seen in my life. Error handling is from the sto…

Yes. Go is all about writing simple, boring, code that works (to paraphrase another comment here). And works really fast.

>boring

Not boring. Just "full of boilerplate" which also means that it will be a nightmare to maintain at a certain point of the lifecycle.

Re: Learning Go as a Node.js Developer

#73

So I am trying to move away from NodeJs for my next project and I can't decide between Elixir and Go. Can't decide what to choose, any idea if there is any advantage for a noob to learn one or the other?

I don’t see why you move away from Node unless it was for a JAVA spring boot or .net core, especially now that node has actually begun to enter real world usage and enterprise on a large scale. Then again I would have said something similar about picking up Node in the earlier days, so who knows. I doubt Go and Ekixir will ever gain the same reach Node has though. Node has the advantage of JavaScript being an unavoid…

I'm looking for a web job in Paris at the moment and there is definitely many Go offering, maybe not be as much as Java or C# (I don't look for those) but still.

Also I went to the last Elixir meetup and there is some companies hiring, but it's obviously very new.

Re: Learning Go as a Node.js Developer

#74
post #68

Earlier quoted context omitted.

Yes, I know. But that doesn't help at all with the lack of releases, changelogs, etc. As I said, it's a decent start.

https://github.com/golang/dep/releases https://github.com/golang/dep/graphs/commit-activity Agreed that it's a decent start, however I disagree with the lack of releases. If you look at the git history there is a lot of activity in it.

I think he's saying the packages you install with dep don't adhere to things like semver.

Re: Learning Go as a Node.js Developer

#75

Is there really anything else in Go than "pretty good standard library". Looking at this and many other Go discussion it seems there isn't. I've been using Go for a while now and while standard library is ok and definitely better than the one in Node.js and I really like strong typing, I still have to say Go is probably one of the worst programming languages I have ever seen in my life. Error handling is from the sto…

> Is there really anything else in Go than "pretty good standard library".

An easy to understand language spec, a compiler that can spit executables that don't depend on glibc, no dependencies on Python 2, and most (if not all) packages under /x/ are BSD licensed.

> Error handling is from the stone age

I actually prefer this approach to explicit error handling, as opposed to the trendy "uncontrolled non-local gotos" approach (a.k.a. "exceptions". I'm borrowing that term from someone else).

The only sane-ish approach to exceptions I'm aware of is that of Java, where you explicitly have to tell which exceptions can happen, and force you to either handle them right there, or modify your function signature accordingly.

Still, with a big `try/catch`, if two calls throw the same exception, both exceptions would go to the exact same `catch` block.

Yeah, thanks, but I appreciate how Go makes ignoring errors very eye-catching. Makes code review easier.

> no support for generics

Devs are actually very open to generics. The thing is, nobody has, as of yet, proposed any implementation that would play nice with the rest of the language.

> no support for functional programming

I don't see the problem. It's not like every new programming language should support every possible feature known to humanity. They would end up like C++, where you don't know if the next version will add the Unreal Engine to the stdlib.

If anything what we need is more minimalist programming languages, not the next bloat of the century.

> no real enum but instead "a hack" you have build by yourself

I can see the point here.

> dependency management without versions

This is actually one of the things I like the most about Go. "Fix your thing to work with the latest version, or bundle your working version", sounds very reasonable to me.

No concept of versions, no centralized source for anything. Just repositories and an ad-hoc way to setup your "registry" just by including an HTML tag in a web server you own.

The only assumptions made about "packaging" is that (1) they're somewhere on internet, and (2) you have the command necessary to fetch them.

If anything, what I don't like about `go get` is that adding a new "handler" requires recompiling the `go` executable.

> Also the hyped features such as channels are nice, but nothing a simple Rx-library couldn't do.

Sure. Go brings nothing new to the table.

> Due to the language limitations it's also nearly impossible to write elegant code with Go.

Most Go code looks elegant to me. Same formatting everywhere (except when someone does not use `gofmt`).

It also means that whenever I see `a + 1`, and the code compiles fine, I know it's a numeric addition, and not an HTTP request, for example.

Go is like a language with some linting in the spec. Compiler error for unused variables? Yes thanks!

Makes reviewing code easier.

> If you take a look at any codebase, build by experienced senior developer or junior dev straight out of college/high school the code is almost always the same

Looks like a plus to me.

> Tons of "if err != nil"

I don't know, I always considered a good practice to handle errors as soon and as explicitly as possible.

> and for loops.

WHAT!? No more `for (;;) {}` vs `while (1) {}` discussions!!!11!1!!ONEONE.

Making people think twice before introducing the Go equivalent of `Array.prototype.forEach` vs `_.each` vs `$.each`, looks like a plus to me as well.

Working as close as possible to the primitives unless strictly necessary.

Re: Learning Go as a Node.js Developer

#76

The biggest difference I see: the author immediately reached for a framework instead of checking out the standard library. In Node, the standard library is effectively non-existent, so Node devs get trained and acclimatised to dependencies. In Golang, dependencies are minimised. Everyone tries to stick to the standard library as much as possible. Because the standard library is so good, for most projects this is perf…

> In Node, the standard library is effectively non-existent, so Node devs get trained and acclimatised to dependencies. Have you ever actually taken a look at it? https://nodejs.org/api/index.html > In Golang, dependencies are minimised. Everyone tries to stick to the standard library as much as possible. Because the standard library is so good, for most projects this is perfectly reasonable. Meh. The Python stdlib h…

> bringing in external dependencies in Go is a traumatic experience

Where do I have to sign?

Re: Learning Go as a Node.js Developer

#77

Earlier quoted context omitted.

And yet this is reality: again 99% of applications manipulate objects in code, persist the data in relational databases, and map rows to objects just fine. Some mapping is necessary anyway, and from my experience modern ORM frameworks actually handle complex objects and relations much better than fragile hand-written code. As mentioned, if you're in the 1% scenario where this approach doesn't work then you already kn…

I think it's more 99% of databases are warped horribly to pretend that objects map to tables. If you throw away the concept that anything in your database has to map to anything in your code base, then you design better databases. Different databases, more to the point.

Oh ok, so your code just doesn't deal with data in the database then? I dont understand what point you're trying to make here.

You can lay out your tables however you want, and you can then map them to objects using an ORM. That's what mapping means, to translate from domain to another. There's no limit on how things are actually designed and ORMs usually do a much better job of handling all that bulk code for you. Nothing is stop you from writing SQL yourself if you really need something complex but again, you should know when and where that is.

Re: Learning Go as a Node.js Developer

#78

Is there really anything else in Go than "pretty good standard library". Looking at this and many other Go discussion it seems there isn't. I've been using Go for a while now and while standard library is ok and definitely better than the one in Node.js and I really like strong typing, I still have to say Go is probably one of the worst programming languages I have ever seen in my life. Error handling is from the sto…

> If you take a look at any codebase, build by experienced senior developer or junior dev straight out of college/high school the code is almost always the same

I think that's kind of the point though. Go gives you one way to do things, and makes it really easy to read no matter what your level. It makes things very boring, which imo is a good thing in lots of cases. Its also terrible for some use cases because it is quite verbose (as you mentioned, err != nil can get tiresome if errors don't matter much), so you gotta find a good balance.

Re: Learning Go as a Node.js Developer

#79

So I am trying to move away from NodeJs for my next project and I can't decide between Elixir and Go. Can't decide what to choose, any idea if there is any advantage for a noob to learn one or the other?

Why not both? Take the most popular web frameworks and see how quickly you ramp up in say a week or two week sprint.

I'm more of a fan of the Ruby syntax and the Phoenix framework is definitely a breath of fresh air. My next web project wants to be with Elixir but for a generic cross platform cli program, I'm eager to learn Go.

Re: Learning Go as a Node.js Developer

#80
post #16
post #2

Oh boy, another learning ___ as a ____ developer blog post.

Could you please not post snarky dismissals to this site? We're trying for better than that here. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newswelcome.html

I'm sure you're also trying for better content. I'll continue to embrace my displeasure for posts like these, thank you very much.
Post reply on HN