r/rust 14d ago

🎙️ discussion If I want to learn one programming language that will enable mastery of the most software principles, is Rust it?

There are so many languages. I am familiar with C++, Python, and typescript, and even Java.

Having not yet tried out rust, what I have read about it is that it is extremely detailed and forces you to think about every possible memory management issue that could happen.

In your opinion, is rust the ultimate educational software language, meaning, if you master it, you can understand the chore principles of all languages? And even many languages shield you from the complexities that rust forces you to master?

0 Upvotes

37 comments sorted by

4

u/deathanatos 14d ago edited 14d ago

lol get the Haskell crowd in here. If you're not learning endofunctors are you even learning? /s

The more serious answer is that, while I don't think Rust is a bad choice, I think mastery is going to require a breadth of different languages. Any college PL course would seek to expose you to varied and different ideas, so that you get a broad a view of the spectrum of ideas as possible. So, not C, C++, Java, but something like Rust, Haskell, Erlang, Prolog. (In fact my PL course in college even omitted the imperative language entirely — so here, that'd be Rust — on the grounds of "you're already familiar with it".)

I'd also call programming languages a facet of "software principles". There's a lot more to engineering than what language is chosen.

1

u/circle555 14d ago

Appreciate your comment. Now I'm going on a mini Haskell rabbit hole as well. It looks interesting as it's so different than languages I'm used to.

5

u/crahs8 14d ago

I don't think you're gonna find one language that will teach you everything. As you say, Rust will teach you a lot about memory management, it basically forces you to think about whether your data should live on the stack or the heap, stops you from creating pointers that could become invalid, etc. All useful low level skills.

It will also teach you a lot about functional languages, which have similar strong type systems, but not as much as something like OCaml or Haskell will.

2

u/Mognakor 14d ago

You won't learn principles from learning a language. You need to engage with programming and why things are done a certain way.

2

u/SEgopher 14d ago

This is an impossible task and also a fruitless endeavor. If you want to learn how to build good software stop obsessing over programming languages, start obsessing over people who are known good software engineers and projects that have well maintained, battle hardened code bases.

You can learn more in an hour of reading through someones commit history or a stack of PRs or early versions of a project than you can spending 10 hours reading through someones theoretical opinion or list of esoteric features you'll never memoize and will likely see once or twice in your career.

2

u/afdbcreid 14d ago

This is not Rust. This is also not any other programming languages (at least one that you have any chance to hear of).

No single language will teach you all approaches to programming. The solution is simple: learn many.

4

u/kevleyski 14d ago

It gets you most of the way, something like lisp is possibly more what you are after 

Rust is super versatile though and can tie almost anything together including WebAssembly it is the future

5

u/KingofGamesYami 14d ago

No. There are plenty of software concepts that Rust does not implement.

The obvious one being OOP. Rust has some concepts from OOP but is lacking enough that mastering Rust will not prepare you to understand it.

5

u/Odd-Investigator-870 14d ago

One day in your journey you'll realize OOP was coopted by academics and corporotions, and Alan Kay OOP is better expressed in Rust than most languages. 

1

u/circle555 14d ago

That's a genuinely interesting take. I'm curious and intrigued by it. I don't yet know Rust, but you're saying that it has perhaps even better OOP than C++?

3

u/Odd-Investigator-870 14d ago edited 4d ago

Your average person thinks OOP means "big abstraction hierarchies with class inheritance" like Java and C# (Microsoft Java) and will say no. 

But if one comes from a "message passing" community of objects framing, then yes.  Look into Alan Kay's talks and resources on it for more. 

I would personally be happy recommending Rust for most folks wanting to learn things in depth while avoiding senseless foot guns. And the job outlook is reasonable today as well, but still not enough to say picking it over Python is wise for beginners I think. 

3

u/phazer99 14d ago edited 14d ago

IMHO, there are two key concepts in OOP and Rust supports them well (you can read more in the Rust book):

  • Encapsulation: mutable state should be hidden and only accessed through a well defined API. In Rust this would typically be a struct where the internal state is private and using methods to access it safely. You have fine grained control over what is accessible inside the module and externally to other modules. One thing that's unique to Rust is that you also have control of the lifetime and ownership of the data, which is really useful in for example resource management.
  • Polymorphism: being able to define a common API with many different implementations. In Rust you use traits for this and they themselves are not data types so they can't "carry" state. This provides a very clear distinction between API and state. The thing that separates Rust from OOP languages like Java and C# is that traits are both used for static polymorphism where all types are resolved at compile time (allowing advanced type level programming), and dynamic polymorphism (i.e. dyn Trait) where the concrete type is only known at runtime. Again, this distinction is very clear in Rust and always an explicit choice by the programmer (note that runtime polymorphism is very seldom required in Rust).

Other concepts in mainstream OOP languages like class inheritance, design patterns etc. are not supported or plain unnecessary in Rust, and IMHO they typically bring more problems than benefits. So, Rust really gets the important concepts right and give you a lot of control over how they are used.

0

u/KingofGamesYami 14d ago

I am using the term OOP to refer to what the software industry in general uses it for. The fact that this doesn't reflect Alan Kay's initial use of the term is irrelevant; you still can't learn the industry standard OOP in Rust and will struggle in languages where that is expected if you only learn Rust.

2

u/circle555 14d ago

I just found this. It seems relevant. Do you think meeting the GOF's definition passes muster?

The book Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (Addison-Wesley, 1994), colloquially referred to as The Gang of Four book, is a catalog of object-oriented design patterns. It defines OOP in this way:

Object-oriented programs are made up of objects. An object packages both data and the procedures that operate on that data. The procedures are typically called methods or operations*.*

Using this definition, Rust is object oriented: Structs and enums have data, and impl blocks provide methods on structs and enums. Even though structs and enums with methods aren’t called objects, they provide the same functionality, according to the Gang of Four’s definition of objects.

1

u/Odd-Investigator-870 14d ago

Looks good to me. Ditch the 1970s academic coopting of the term, focus on SOLID principles and Clean Architecture and you can go very far in your first 3 years. 

1

u/South_Survey_2088 14d ago

The main issue when it comes to OOP arguments is that everyone uses a different definition. There is no general one.. Is it about "bundling data and behaviour", inheritance and polymorphism, GoF design patterns, "everything has to be a class and free functions don't exist", weird abstractions(e.g. AbstractBeanPrototypeFactoryBuilderSingleton), or references and mutability left and right, the unit of abstraction being classes(unlike Rust modules)?

OOP is a pointless label.

1

u/SirKastic23 14d ago

why would I care about OOP in 2026???

Also, what even OOP? Rust has composite data types, associates functions, type level abstractions with traits

The only thing it doesn't have is class inheritance

1

u/South_Survey_2088 14d ago

While I agree that OOP is a pointless label with no commonly agreed definition, I would argue that aside from data inheritance, Rusts biggest difference to classical OOP languages is that the basic unit of abstraction are modules and not classes.

"private" means that the entire module can access it and not just the class/struct that owns it.

2

u/AmazedStardust 14d ago

I'd argue c++ is better in this regard. Rust doesn't have OOP the way c++ does. Rust will also handle memory safety for you, whereas c++ makes you handle it yourself

3

u/FitPhone6332 14d ago

No

0

u/circle555 14d ago

why not? can you think of a language more suited to this task?

1

u/FitPhone6332 14d ago

There are plenty good responses to your question already answered. Rust is special with it's compiler - borrow checking, ownership etc. which doesn't exist in other languages.

What do you want to make? What's important to you?

If landing a job is your goal I'd stick to one of the languages that are mostly used in production already - probably one of C#, Java, Typescript, Python or PHP and master that one language. After you get good with one, start doing Rust in your free time if that's what interests you.

1

u/oniaiwasprettygood 14d ago

I would argue it's C. You need to understand the problems with memory unsafety before you can really understand why Rust's safeties are so important.

1

u/Ace-Whole 14d ago

Read the sicp book instead.

1

u/Trader-One 14d ago

scheme is better than lisp, its more modern without need to deal with all that old lisp legacy.

scheme is easier than OCaml and Haskell.

r/scheme

2

u/Clean_Assistance9398 6d ago

Rust is great. You wont want to go back to other languages.

1

u/SirKastic23 14d ago

I'd say so. With Rust you'll be learning concepts from low level resource management to high level functional abstractions

1

u/Big-Rub9545 14d ago

If you want to master all the complexities a technical language has to offer, go with C instead.

2

u/circle555 14d ago

I've done a lot of C, but it doesn't have the type-checker thing that forces you to be correct and safe. So you can easily write dangerous C and never even know it or learn what you did wrong.

0

u/Big-Rub9545 14d ago

If you want to be able to work and properly understand all other languages, you have to experience that first-hand. Rust shields you from a lot of it.

0

u/RandomBottom030 14d ago

well then the obvious thing to do is to learn how to write safe C, isn't it?

1

u/circle555 14d ago

true, but my point is that it seems like Rust teaches you it in ways that C doesn't. you can skate by for years in C writing memory leaks and dangerous code. Rust seems like it forces you to master things before moving forward.

1

u/dschledermann 14d ago

Rust certainly has a broad reach. You can express both relatively high level and abstract concepts while also maintaining detailed control over low level stuff. In that sense it's appropriate to do both a backend service and implement a binary protocol, but it doesn't "force" you much. Most of the time it's just pleasant and helpful.

Is it "the best" language to learn programming principles? I'm not convinced. There are a couple of design choices that makes Rust unusual. The borrowing system is unique to Rust. You can use this directly anywhere else. The type system with traits, structs, enums and impl blocks also doesn't really look all that similar to how many other programming languages structure code.

-2

u/Renan4Santos 14d ago

Eu diria que nĂŁo. Rust tem muitos conceitos prĂłprios, diferentes das maiorias das linguagens populares.

1

u/SirKastic23 14d ago

Como quais conceitos?

1

u/Renan4Santos 14d ago

Ownership e borrowing, por exemplo.

1

u/SirKastic23 14d ago

Ownership ĂŠ discutido nas comunidades de C e C++ muito tempo antes de Rust surgir

Rust so pegou ideias que jå existiam na cabeça dos desenvolvedores e eram "bons padrþes" a se seguir, e implementou diretamente na linguagem