r/javascript • • Apr 15 '18

My journey from Node to Go

https://medium.com/@OmisNomis/my-journey-from-node-to-go-4b657f57836e
63 Upvotes

69 comments sorted by

143

u/spacejack2114 Apr 15 '18

Node is the language ...

ಠ_ಠ

1

u/OzziePeck Apr 16 '18

I had someone call it a framework once.

1

u/papers_ Apr 16 '18

By that logic, so is the JDK...

...No..

-9

u/dangerzone2 Apr 16 '18

Jeeze, tough crowd...

1

u/[deleted] Apr 16 '18

Welcome to development.

0

u/[deleted] Apr 15 '18

[deleted]

69

u/[deleted] Apr 15 '18

This guy is a “senior developer” who doesn’t know the difference between a programming language and a runtime environment? Is the demand for developers really outpacing the supply by that much?

5

u/dug99 Apr 16 '18

cue old school cash register sound :D

-7

u/[deleted] Apr 16 '18

God dammit you people are picky!

Node has become interchangeable with meaning "Javascript for the backend" or "Javascript development using the Node runtime environment"

Some people just love to moan...

10

u/[deleted] Apr 16 '18

Simply having your blog post proofread, especially when you're out advertising it on platforms like reddit, is a must. The moaning here is about a senior developer making a rookie mistake in the core domain of his blogpost. And in that sense I consider it completely justified.

-8

u/[deleted] Apr 16 '18

Mistake implies I did it by accident. I purposefully used Node in that context and, if writing the blog post again, I'd do it exactly the same.

Anybody that knows JS/Node knows exactly what that reference means, it's just picking for the sake of picking.

14

u/[deleted] Apr 16 '18

Yeah I'm sorry but being wrong on purpose doesn't justify anything.

0

u/[deleted] Apr 16 '18

[deleted]

1

u/[deleted] Apr 16 '18

Not at all man, I was just trying to explain why you're getting so much slack. Feel free to continue ignoring it however.

1

u/[deleted] Apr 21 '18

As a writer, who presumably wants others to read your writing, the most important thing is credibility. If you don't have credibility, why would anyone read anything that you've written?

By inventing a "context" in which "Node" is a programming "language" (protip: "wrong" is not a credible context), you demonstrated a lack of credibility. What's worse is that you did so right up front, giving everyone with even a casual knowledge of the topic a reason to immediately stop reading.

Now you're going to double down on that mistake and insist that it was intentional? Zero credibility. First rule of holes, my man: stop digging.

0

u/[deleted] Apr 21 '18

You are entitled to your opinion.

3

u/monsto Apr 16 '18

I can't say I disagree with you...

I would however advise: when posting a piece like this, or a question on Stack Overflow, you must get everything exactly perfect.

If your question is about outputting a table, but somewhere you say "i run a loop to iterate over my array, then use the data to populate the table, but the table is fucked up", guaranteed that someone will respond

why are you using a loop? Use forEach.

TL;DR Your questions, statements and intent need to be seamless, focused, and bug free. Otherwise, a polyp of discussion will lead to a discussion headed off into tumorous East Egypt... until you get one guy that comes in on the main question. "you missed the </tr> on line 7"

1

u/[deleted] Apr 16 '18

Yeah I'm starting to see that. From my point of view I only write to help others, it takes me ten times longer to learn something when I'm blogging about it but I do it in the hope it will help someone else.

It just gets my back up when people hit you with technicalities that are pointless.

7

u/lukasbuenger Apr 16 '18

From my point of view I only write to help others.

But this is exactly why this kind of stuff matters. I don't necessarily agree with the tone of the criticism, but if every other dev blog post was so casual about terminology, you'd have just more people lost in translation, especially beginners.

5

u/[deleted] Apr 16 '18

Fair enough. Genuinely, put like that, I can see the point.

1

u/bpadair31 Apr 16 '18

No, it really hasn't.

79

u/well-now Apr 15 '18

I was expecting a journey. Not a first attempt at a hello world app.

1

u/djslakor Apr 16 '18

Same here.

26

u/thenickdude Apr 16 '18

The Node app starts accepting connections before the connection to Mongo is completed. This seems unhelpful.

1

u/bpadair31 Apr 16 '18

When you refer to Node as a language, I have no interest in anything else you have to say in relation to development.

-1

u/[deleted] Apr 16 '18

Great. I'm glad you thought it was worthwhile commenting that.

7

u/mihaelamj Apr 15 '18

There is another option: Server Side Swift. Swift is alco compiled but does not have a GC!

https://vapor.codes

5

u/creedasaurus Apr 15 '18

I'm kind of fascinated by this idea of using Swift for things other than Apple development. But has there been much adoption in the industry? I dived into Go because I thought it was interesting, but I also felt the demand was growing where I'm from. Anyway, I'll have to look at Vapor. Looks cool.

2

u/[deleted] Apr 16 '18

I've really enjoyed my limited experience with Swift. It's a shame that I have no interest in developing macOS/iOS apps because it's really a joy to work with.

If anyone cared to use it for more general-purpose stuff, I think it'd take a chunk out of C#'s market.

2

u/filleduchaos Apr 16 '18

It would take a mountain of marketing effort/outreach to get the dev community at large to see Swift as useful for anything other than making Apple apps, and Apple has no-one but themselves to blame for that.

1

u/[deleted] Apr 16 '18

Totally. It has to be intentional on their part. I guess designing a language around a few central purposes is easier in the long run.

2

u/filleduchaos Apr 16 '18

Yeah - it doesn't seem to be hurting their bottom line much if at all. Still, it would be nice if more people knew that you no longer need a Mac/XCode to write and compile Swift.

2

u/mihaelamj Apr 16 '18

You can use Swift on Ubuntu, no need for Apple ecosystem.

0

u/[deleted] Apr 15 '18

What framework would you recommend other than Iris?

7

u/[deleted] Apr 15 '18

None. Use standard libs.

2

u/[deleted] Apr 15 '18

Interesting. What is the standard lib called?

-2

u/[deleted] Apr 15 '18

http

4

u/[deleted] Apr 15 '18

Ah ok. I think I get why I was being downvoted now :)

0

u/[deleted] Apr 15 '18

[deleted]

1

u/[deleted] Apr 15 '18

Cheers. I just had a stupid moment. Thought they were referring to something different.

-1

u/PantsuWitch Apr 16 '18

Programmers, especially on reddit, are terrible people that tend to hate newcomers.

Not really, only new comers who declared themselves as "senior developer".

-1

u/Skhmt Apr 16 '18

Programmers, especially on reddit, are terrible people that tend to hate newcomers.

TIL I'm a terrible person.

0

u/yeahdixon Apr 15 '18

Go community tends to push away from using exterior libs for shortcuts and rather you just code it yourself.

2

u/monsto Apr 16 '18

Is Go that "batteries included" that Auth and ORM are part of the standard libs?

0

u/[deleted] Apr 15 '18

[deleted]

3

u/Dedustern Apr 16 '18

The Go stdlib has nearly everything you need. There is little reason to use frameworks with Go, unless you have something really specialized said framework will solve.

Go is build for web/networking. It doesn't need a framework like other languages.

-2

u/yeahdixon Apr 15 '18

Well also it removes external dependencies

0

u/[deleted] Apr 15 '18

[deleted]

1

u/monsto Apr 16 '18

Don't take the bus to work, just walk instead of relying on transportation to solve all your problems.

There's plenty of value to not using a framework for a first few projects. But beyond that, there's plenty of upside reasons.

Confidence that authorization/authentication/accounting controls are current and bugless is only one of them.

1

u/[deleted] Apr 15 '18

I'll be honest, I don't know (I've only been playing with Go for a week or two). I will be doing some research on this over the coming week or so, and can report back once I have a recommendation?

1

u/drink_with_me_to_day js is a mess Apr 15 '18

http is alll you need.

But I do like echo.

-3

u/[deleted] Apr 15 '18

The standard library does everything you need.

0

u/dangerzone2 Apr 15 '18

I'm in a very similar situation. I've been slowly moving my favorite backend stack from Node -> TypeScript -> Go. Its a pretty natural progression.

A couple negative of go are the GOPATH weirdness and lack of 3rd party support. The 3rd party libraries are there but theres no NPM to easily search, compare and review them.

2

u/[deleted] Apr 15 '18

Appreciate you sharing! There are definitely things I like about Go. I can see it being another tool in the tool belt, but I can't see it replacing Node

2

u/dangerzone2 Apr 15 '18

not yet :)

1

u/[deleted] Apr 15 '18

We'll see :)

1

u/Pawda Apr 16 '18

Would you mind sharing why not ? IMO Go is already mature enough. I find prototyping to be still faster with Node but except that, Go already offers everything Node has and much more.

1

u/filleduchaos Apr 16 '18

Go already offers everything Node has and much more.

Even Node/JavaScript has generics (via TypeScript, but still).

1

u/Pawda Apr 16 '18 edited Apr 16 '18

Generics are eventually coming in go 2. I don't really have a position there, Golang offer other ways to do fine without them so I don't miss them. Btw, why would you mention generics on JavaScript/Node, seriously this is pure troll, the language already doesn't enforce types... Developers always needs to find issues when there is none. Are you one of the kind that prefer write a thousands lines of JavaScript in order to respect all the S.O.L.I.D. principles where 50 lines would have be enough ?

1

u/filleduchaos Apr 16 '18 edited Apr 16 '18

Golang ofter other ways to do fine without them so I don't miss them.

> Arrays, maps and slices are literally generic types

> Other ways include copying and pasting code

> doesn't miss generics

thinkingface.jpg

Edit: can't forget the other way of using Canadian Aboriginal Syllabics

0

u/monsto Apr 16 '18

Would you mind sharing why not ?

From what I've seen in this thread so far, the main reason is very clearly the foundational elitism. The mentality of scoffing at external libs "write it yourself" forces the lack of a package manager where you could find an already invented wheel... for things like front end templating.

Every major web-centric language has a package manager/repository . . . because developers are interested in building complete apps, in a timely manner, to serve a purpose, as opposed to "doing it the right way" and building from scratch.

Using a framework to build an app is like making a sandwich with premade cheese, ham, etc. Django, Laravel, Rails and Express/Koa make fine sandwiches.

1

u/Pawda Apr 16 '18 edited Apr 16 '18

Well, I cannot deny the elitism but I think it's changing with the time.

So far with go, It's more about having quality packages than having a hundred left-pad. Personally, I like to write in a language where I can see the best practices, where main frameworks are well established and I don't have to run a 1GB boiler plate for an hello world.

There is bunch of reasons why smarts people like TJ (express/koa creator) decided to leave Node.JS for Go. https://medium.com/@tjholowaychuk/farewell-node-js-4ba9e7f3e52b

2

u/Capaj Apr 16 '18

How about sticking to REST next time? I get shivers when I see endpoints with random paths like that. Also node.js app could have been written more succinctly using koa.js.

1

u/[deleted] Apr 16 '18

res.send(ToDo created: ${JSON.stringify(todo)}).status(201);

Please don't do this, or encourage others to do this. You're so close to sending down useful JSON that can be consumed by the client, but instead you prepend unnecessary text to the beginning and completely screw up the payload.

A response of 201 already indicates that the todo was created.

0

u/bmrobin Apr 16 '18

I've been interested in Go for awhile. this was a great write-up on your experience. thanks a lot!

0

u/[deleted] Apr 15 '18

[deleted]

1

u/[deleted] Apr 15 '18

Thank you! I've not tried rust, is there a reason you recommend it?

4

u/spacejack2114 Apr 15 '18

Seconded. I started tinkering with Rust a bit here and there and it's a pretty darned cool language and package manager (git clone, cargo run is about a million times better than any cross-platform C/C++ install experience.) The main drawback is that support libs for things you might want to do may not really be there yet, or very alpha.

5

u/bernardosousa Apr 16 '18

Thirded. First, I noticed that, on the official WebAssembly page, they only give three examples of languages you can compile to it: C, C++ and, you guessed it, Rust. I got curious. Wikipedia made me think about this notion of "safe code". With C at university, I was told " with great power comes great responsibility", meaning C lets you do dangerous things. It's up to you to be carful. Rust, in the other hand, tells me it will help me to write safe code without sacrificing any performance (unlike JS, which is not known for performance). I liked that promise and decided to listen to a few episodes of the New Rustacian podcast. Ended up exhausting the episodes. Now I'm reading The Rust Book, second edition. I have already explored short introductions about many languages. None have grabbed my attention like that. I don't know why I bought into it so easily, but I have a good feeling about where this is going. Hopefully learning Rust doesn't get me too frustrated about my day JS job.

0

u/[deleted] Apr 15 '18

[deleted]

3

u/[deleted] Apr 15 '18

Interesting! I'll have a look into Rust then! Thanks for the recommendation. I'm a self taught JS Dev so I'm always looking to pick up any missing concepts.

1

u/Cedricium JavaScript makes me go :snoo_putback: :table_flip: Apr 15 '18

Any good beginner-friendly resources for starting to learn Rust?

2

u/Dedustern Apr 16 '18

I've started to learn Rust over the weekend, it's really nice, though I will use Golang primarily at work. I can't really see many cases where Rust would be picked over Go? Although, the ecosystem/environment around Rust is much better than Go -- especially dependency management(which is a huge weakpoint of Go imo.)

0

u/[deleted] Apr 16 '18

[deleted]

2

u/Dedustern Apr 16 '18

Yeah I'd really like to learn Rust but I can't really "imagine" what to build for fun? Like, with Go it's pretty obvious, and I've learned it pretty fast from building microservices, or doing disk I/O stuff. But coming from the "business logic" side of things, and moving towards systems/network engineering, I really have an issue picking up stuff to build. It's easier to make up some business stuff and solve it, than systems/networking stuff :-/

0

u/[deleted] Apr 16 '18

[deleted]

2

u/Dedustern Apr 16 '18

I like fiddling with new tech. So it's fine. Want to build basic stuff, maybe I'll copy some of my Golang programs to rust :)