trifectatechfoundation / teach-rs

A modular, reusable university course for Rust
https://teach-rs.trifectatech.org
Creative Commons Attribution Share Alike 4.0 International
2.98k stars 140 forks source link

Define different learning tracks #55

Closed hdoordt closed 11 months ago

hdoordt commented 1 year ago

Rust 101 is meant to be multi purpose. Therefore, we define a set of different learning tracks consisting of several modules of which we define modules and subjects their content is dependent on.

As a start, we can define the following tracks:

We also explore the possiblity of setting up a track that uses Rust as a first programming language. See #25

hdoordt commented 1 year ago

@squell I took the liberty to draft a proposal for a new structure. The main idea is that we define a basic module (A), and some modules that are optional depending on the track that is being taken. I've listed the modules with their topics and the tracks below. Especially the modules further down are not as detailed as I'd like them to be yet, but you'll get the idea. Also, we need to split up the modules into parts that are suitable for single lecture+tutorial sessions. Feel free to add your thoughts on this.

Also, I'd like to think about how we can incorporate the work of @coastalwhite into this (#25).


Modules

A. Intro to Rust

Get to learn the language

Dependencies: ∅

  1. Why Rust
    • Problems Rust aims to solve
      • Memory safety
      • Concurrency bugs
    • Brief history
    • Design goals
      • Memory safety
    • The space Rust is in
    • What you can use Rust for
  2. Your first Rust project
    • Short intro to Cargo
    • Setting up a new project
    • app vs lib crates
    • Cargo.toml overview
    • Crates.io/lib.rs/docs.rs
  3. Basic syntax
    • Main entrypoint
    • Variables
      • Mutability
      • Type annotations
      • Type inference
    • Primitive types
    • Numeric & boolean perators
    • Tuples
    • Arrays
    • Functions
    • Statements
    • Expressions
    • Flow control
      • if else
      • for in
      • while
      • loop
      • break and loop expressions
      • return
    • Scope
      • Dropping is destructing
      • static
    • String
      • UTF-8
      • Heap-allocated
      • Dealloc on drop
  4. Ownership & references
    • Variable ownership
    • Move semantics
      • Copy types (primitives)
      • Non-copy types (heap-allocated types)
    • Borrowing
      • References
        • Immutable vs mutable
      • Borrowing rules
      • Memory safety implications
  5. Composite types
    • Structs
      • Tuple strict
      • Struct with named fields
      • Empty struct
    • Enums
      • Tuple variants
      • Struct-like variants
      • Memory layout
  6. Pattern matching
    • if let
    • match
      • Exhaustiveness
      • Arm priority
      • Guards and bindings
    • while let
    • let else
    • Irrefutable patterns
    • Destructuring
      • Tuples
      • Arrays
      • Structs
  7. impl blocks
    • Associated functions vs methods
    • self vs &self vs &mut self
    • .-operator
    • Self
  8. Handling optionals or errors
    • Generic intro
    • Option
    • panic
    • Result
    • unwrap
    • ?-operator
  9. Slices
    • Sized vs unsized
    • [T] vs &[T]
    • Memory layout
    • &str
  10. Traits
    • Trait methods
    • Associated types
    • Associated constants
  11. Generic programming
    • Type parameters
    • Type parameter bounds
      • <T: Trait> vs where T: Trait
    • Generic traits
      • Vs associated types
    • impl Trait
    • Monomorphization
  12. Lifetime annotations
    • Within fn signatures
    • Within type definitions
    • Lifetime elision
    • The 'static lifetime
  13. Closures
    • move
    • fn vs Fn vs FnMut vs FnOnce
  14. Smart pointers
    • Box
    • Vec
    • Rc
    • Drop
    • Deref & DerefMut
    • Deref coercion

B. Application programming

Develop larger projects with Rust

Dependencies: A

  1. API Guidelines
  2. Design patterns
  3. Testing
    • Unit testing
    • Integration testing
    • Benchmarking
    • Fuzzing
  4. Tools
    • Licence checking
    • Audit

C. Concurrency

Learn Rusts concurrency models

Dependencies: A

  1. Parallelization
    • Spawning threads
      • Threads & lifetimes
      • Scoped threads
    • Re-defining references
    • Send&Sync
    • mpsc::channel
    • rayon
  2. Syncronization
    • Atomic*
    • std::sync::atomic::Ordering
    • Mutex
  3. async Rust
    • Comparison to threads
    • Comparison to other languages
    • Future
    • async and await
    • Runtimes
      • Variations
        • smol
        • tokio
        • embassy
        • async-std
      • Compatibility
      • Intro to tokio
    • spawning tasks
    • Borrowing over awaits
    • futures crate
      • Stream
      • channel
      • Mutex

D. Rust for web

Learn to use Rust for web applications

Dependencies: A, B, C.1, C.3

  1. std::net
  2. Backend development with axum
  3. Database interop with sqlx
  4. wasm frontends
  5. Using serde

E. Rust for systems programming

Learn to use Rust for systems programming Dependencies: A, C.1, C.2, C.3

  1. Unsafe Rust
  2. FFI
  3. Rust ABI and memory layout
  4. Unix syscalls
  5. async primitives
    • mio
  6. Rust in the Linux kernel

F. Rust for embedded (Cortex-M)

Dependencies: A, C3

  1. #![no_std] and core
  2. #![no_main]
    • cortex-m-rt
  3. Rust embedded ecosystem
    • cortex-m
    • PACs
    • HALs
    • embedded-hal
    • Drivers
  4. Portable drivers
  5. RTIC
  6. embassy
  7. Rust in IoT

G. Rust for data science

Dependencies: A, C1

  1. PyO3
  2. Polars
  3. ndarray

Tracks

squell commented 1 year ago

First thoughts about Rust-as-a-first language (which I had thought about last week as well):

I.e. I think it's a worthwhile thing but maybe something that needs something separate (Programming-101 using Rust), and then finish it off with lots of ideas and suggestions for students "good first Rust projects", and tell them they continue their journey with the B-modue later.

hdoordt commented 1 year ago

Notes:

A: add topic on trait objects C: add part on intro to multithreading as the concept may be overwhelming to students that have never written parallel code before E: possibly refer to B1, maybe add part on multiprocessing (fork) F: Add embedded-specific topics on synchronization, atomics, mutexes, possibly on RTOS integration

In teacher's guide #54 , we can suggest pick'n'mixing modules Add more advanced topics to leaf modules Possibly add topic on Pin to systems or async or even A

hdoordt commented 1 year ago

Another thought: we can add content on macros to B