Learn C or Rust first?

5 points by Pharohbot ↗ HN
I'm 15, I know JavaScript and taking AP Java in school(I really don't like it), and I'm very intrigued by Rust. Should I learn C first though? I don't really want to but some people said I should but some others said it doesn't matter, since you can learn a lot a bit less of what C teaches you(since some Rust libraries hide some complexity, is it really important though?), but its still a lot of information about how memory/computers work, however, I'm more interested in the language than how the computer's internal systems work right now.

14 comments

[ 9.4 ms ] story [ 102 ms ] thread
I'd suggest Go over Rust for a beginner. Go would allow you to do pretty much any kind of project you wanted (web API, mobile app, CLI tool), which is what's important for learning: having little hobby projects that you do on your own.

By learning Java, you're already getting some good CS fundamentals. It probably wouldn't help you that much to learn C on top of that.

I'll leave you with this: if you want to make programming into a career, you don't need to learn C. If you want to study programming as a researcher or teach it, you should learn C.

Being 15, you don't know what you want to do though, so I'd suggest just doing what you find fun for now and worry about the rest of it later.

I dont personally like Go, but from what you mean, since im taking Java, I dont need to learn C on top of that, so I can just get into Rust(and i want to be a web developer as a career). plus Rust has its frameworks like Nickel and Iron that are being actively developed on.
My more important point is that you don't need to do anything right now. Just do some stuff that you find fun.
This is really bad advice, except for the last part. :)

If the idea is "Hey, let's use a framework good for beginners and hack together projects", OP should just extend their Javascript knowledge into Nodejs--and there's nothing wrong with that.

"By learning Java, you're already getting some good CS fundamentals."

This is wrong. If you are trying to learn CS fundamentals, learn Scheme or Clojure or some other functional language. Java in practice is basically plumbing together large frameworks built by people smarter than you who probably worked at Sun fifteen years ago--and who often got things wrong. Java in theory is ramming OOP design down your throat, and still exposing enough implementation details of the runtime that you can't ignore them.

Java is a not a good way to learn CS fundamentals.

if you want to make programming into a career, you don't need to learn C.

This is only true if you want to be a blub programmer and punch the clock and basically just farm code in enterprise. Learning C is essential (barring learning assembly) to getting access to great swathes of performance-critical environments, tracking down weird bugs, and generally understanding what you machine is doing.

This is only true if you want to be a blub programmer and punch the clock and basically just farm code in enterprise.

Times change. A lot of (what I would consider) interesting jobs only require web languages, which are high-level, messy, and abstract away a huge amount of underlying complexity (many would say too much).

I'm telling him/her how things are, not how we want them to be. Only a small fraction of being can be great engineers. The rest of the millions of developers out there are writing sloppy blub code on top of an opinionated framework.

If you are trying to learn CS fundamentals, learn Scheme or Clojure or some other functional language.

I don't think we're using the same definition of "fundamentals". I was talking about things as simple as writing code, compiling, debugging, and googling (the most important skill of a programmer).

S/he'd also be learning OOP, which dwarfs FP in the web development world[1]. I actually don't think I've ever heard of a popular web framework that was written functionally, though I should also mention that I think the practical differences between FP and well-written OO are exaggerated. They aren't mutually exclusive, and OO doesn't imply mutability.

1. http://lifehacker.com/the-top-programming-languages-ranked-b...

Maybe you could briefly go through K&R, it is both readable and challenging. Then start Rust
I strongly disagree, when I was 15 I got the same advice and it nearly turned me away from programming. K&R is not a good standalone text book. (Sure I had no internet and just a redhat5 clone, but K&R just was not that helpful)

I would pick Rust to learn over C when starting today. Rust matches today's machine beter. It is a more organized language and eco system. And most of all learning to code corect is easier when you do not run into undefined behaviour right and left.

So a modern language like Rust will expose more concepts to you and picking up C is easier afterwards, although you might not want to.

Learn C first. Learn C first. Learn C first.

It's a small language, it's everywhere, and it's going to build character.

Rust is still undergoing active development, and solves a different problem space than C by virtue of what it adds. It's a good language, mind you, but it doesn't expose you to the warts of hardware like C will (by design!). It won't let you deal with null or dangling pointers. It will abstract away data types with let. It will treat memory safely (which it really isn't). It's a great language that will hopefully replace C one day, but that doesn't mean you should start there.

Learning and debugging C will help you understand how processors work (especially if you start with something simple like an MSP430 devkit). You can look at the code and the generated assembly and see pretty much how the compiler came up with what it did. If you're developing on a Unix descendant, you'll be dealing with things at a level the operating system intends.

You'll get to look at a huge corpus of code already out there and see what works and what doesn't, and if it strikes you you'll be able to modify it (say, making mods for Half-Life or Quake 3 or whatever) and see how things work.

Start with C!

EDIT:

Later, you'll see why C needed replacing. You'll never appreciate Java fully, for example, without dealing with all the stupid C++ allows.

Comedy option--learn Erlang or Elixir--you'll be spoiled for the rest of your career once you see how annoying things can be elsewhere.

but I stated that I do not wish to learn about how the internals of the computer works, rather than im more interested in the language itself, which is Rust. plus I saw Elixir, I didnt like it all :(
You can never truly understand the language unless you learn about things it compiles into.
do you know assembly ? and what about raw binary ?
So, no language worth it's salt completely hides how the computer works from you (again, except for certain members of the FP family, or declarative languages like Prolog or SQL).

For example, Javascript has a problems when adding ".1+.2". Know why? IEEE754 limitations on double-precision floating-point arithmetic, as implemented in hardware.

Programming languages exist to program the machine, full stop. Everything else is just people faffing about on their thesis defense.

Anyways, if you didn't like Elixir--probably because you don't have the experience yet to see why it's awesome--that's okay: learn C. :)

I really meant that I prefer JS(Node/IO) over Elixir.
I never wanted to learn the details of how a computer really work as, but I spend a single week learning C, just to learn the basic concepts like pointers. It really helped me understand better other languages. Besides, It would take you many years for you to master it, and the kind of jobs you would get with it would f* damn boring. Don't waste more than a week on it :)

I'm learning Rust at the moment, I feel I can express my ideas better with it versus go. But as a hobby. for fun.

I've being coding exclusively in JS for 3 years. And just now I feel comfortable with it.

There is so much going on with it. I bet you heard about OOP, but what about functional programing. And functional reactive programing ?

There are so many libraries and framework in JS. It just crazy. There is angular vs ember. And what about react or famo.us ? And there is nodejs, and things like npm, gulp, browserify.

To learn javascript, the language is one thing. But all its tools is another.

The reality is this, the more languages you learn, the easier it is to learn a next one. Today I know over 10 languages, but I master only one. And that is what matters, the one you master.

But what I things is super important for a programmer this days is a basic knowledge of shell and git. IMO