top | item 38229289

(no title)

trustingtrust | 2 years ago

I have always felt there has been a learning curve for Go and Rust when it comes to syntax for me. I have used C C++ Java and Python and PHP for a long time but whenever I start Go or Rust, over time I lose interest thinking this is too complicated and difficult for me (no idea why).

Is there anyone in the same boat and are there ideas how I can make myself get good with at least one of these trending languages ?

discuss

order

preommr|2 years ago

I found rust very simple to pick up because there's a lot in the language that really helps you to write the code the way rust needs it to be. The language design is really good that way, and the compiler helps a lot. What's tricky is to understand the underlying concepts like it's module structure, ownership, etc.

Writing practical code is harder if you're not used to it because it enforces discipline that a lot of coders in other languages don't care about like the mutability of a variable. For me it just clicked because that's something I always struggled with in other languages and it frustrated me that I wouldn't know how a variable was supposed to be used. The fact that in rust that concept is built into the language makes me excited. If someone doesn't care about that kind of thing then I can see it being very frustrating.

With Golang, I would strongly recommend ignoring all advice. People kept saying it's easy to understand, that it's like python, or that it's like a better C. Forget all that, try to approach it from the ground up as it's own separate thing, dive into what interfaces, slices, etc. actually are. Then write a bunch of practical go code like a webserver, then a lot of go idioms become a lot more obvious. I really feel like there were some lanuage design decisions made where one thing exists because of another feature, so writing some code makes those links obvious as opposed to learning each feature independently.

dewey|2 years ago

For me Go is one of the easiest languages to learn (even if there are some low level bits like closing bodies etc.) just because you always know what goes in and comes out of a function.

When doing Ruby after only using Go for years it was (and still is) very tricky for me to deal with error handling and figuring out what kind of object I'm dealing with.

SkiFire13|2 years ago

> when it comes to syntax for me

If your issue is that the syntax is too complex then you've got a problem since semantics are usually way more complex to grasp than syntax.

Yoric|2 years ago

My assumption is that the parent poster uses the word "syntax" for "syntax and semantics". It's a common trend.

denysvitali|2 years ago

Go and Rust have certainly a different learning curve. Go is supposed to be incredibly easy.

Rust's learning curve is waaay steeper than that

imjonse|2 years ago

First of all don't try to learn both of them at the same time you just add unnecessary anxiety. And as others have said, Go is much easier to learn that Rust, both the syntax and the underlying concepts are simpler. Just go through the Go playground tutorial on the site or try rewriting some of your C/C++/Java code. It is not as good a replacement for most Python and PHP code in my opinion.

pserwylo|2 years ago

I find a good IDE that you are already familiar with from other languages/environments goes a long way. Pick your poison, but for me because I'm already using IntelliJ for Java at work and Android Studio for open source projects, I was able to get into Go relatively easily recently using IntelliJ.

The linter/autocompletion/auto-fix/refactoring/etc made it much simpler to a avoid having to rote-learn the syntax for functions, lambdas, structs, etc. To go with that, the error handling becomes much easier to learn because the editor is able to tell you when you've got the wrong number of return values / wrong type of values.

Yes, the compiler does all of this, but the way it happens in real time using the same keybindings/UI/UX that I use for my day job makes it all that much easier.

mplewis|2 years ago

Good news! If you’re familiar with Python, Go is at its heart not that different. It has fewer features and the syntax is similar, which makes it easy to learn.

Try the interactive Go Tour, and review the Learn X in Y Minutes page for Go to get familiar with the new features. Then try building a fun toy project in it. Go makes it easy to build web servers, so maybe a REST service is a place you could start.

codegeek|2 years ago

Funny you say that. As a PHP developer, I found Go to be the easiest to pick up.

mft_|2 years ago

Hah, you’re describing almost exactly my feelings the few times I’ve tried to learn Swift…