Coder Social home page Coder Social logo

tweedegolf / 101-rs Goto Github PK

View Code? Open in Web Editor NEW
2.7K 47.0 122.0 3.71 MB

A modular, reusable university course for Rust

Home Page: https://teach-rs.tweede.golf

License: Creative Commons Attribution Share Alike 4.0 International

Rust 73.16% C 26.84%
education rust

101-rs's Issues

Improve modmod

After dogfooding a bit, here's what I think would improve modmod a lot:

  • Update already-generated courses
    • Reuse current package.json
    • Reuse slides that have not been generated and are specific to the users context
    • Idea: generate patches that could be applied manually using gix-diff?
  • Copy the license
  • Generate VSCode settings (e.g. "rust-analyzer.linkedProjects") and recommended extensions
  • Allow for easily generating stubs for topics, modules, tracks

Cannot create a Vec literal (compile error in slices/slides.md example)

Hi, awesome work! When I recorded my video based on your slides this morning I noticed something that didn't look right.

In this example in slides/slides.md:

fn sum(data: &[i32]) -> i32 { /* ... */ }

fn get_v_arr() -> &'static [i32] {
    &[0, 1, 2, 3, 4, 5, 6]
}

fn get_v_vec() -> &'static [i32] {
    &vec![0, 1, 2, 3, 4, 5, 6]
}

fn main() {
  let all = sum(get_v_arr());
  let all_vec = sum(get_v_vec());
}

There is a compile error:

error[E0515]: cannot return reference to temporary value
  --> src/main.rs:10:5
   |
10 |     &vec![0, 1, 2, 3, 4, 5, 6]
   |     ^-------------------------
   |     ||
   |     |temporary value created here
   |     returns a reference to data owned by the current function

I don't think there is a way to do what we are trying to do here (create a Vec as a literal and expect it to have static lfetime) - I think this example should be edited to mention array literals only.

Update README

Revise current content and add sections on future ideas and roadmap

Add topic 'Why Rust'

We currently have no apt introduction to the (design) goals of Rust. Add a slides that covering the following topic:

Why Rust

  • Problems Rust aims to solve
    • Memory safety
    • Concurrency bugs
  • Brief history
  • Design goals
    • Memory safety
    • Explicitness
    • Zero-cost abstractions
  • The space Rust is in
  • What you can use Rust for

Best would be to contribute it directly to the restructure branch while it's still unmerged. There's a file on that branch where the content could be added: https://github.com/tweedegolf/101-rs/blob/restructure/slides/A-foundations/why-rust.md

Define different learning tracks

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:

  • Systems programming
  • Embedded development
  • Web development

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

Some exercises are very long

This may be deliberate, but I have noticed that there is a wide variation in the amount of time some of the exercises take. If it is deliberate, maybe it's worth providing some notes so that lecturers can judge when and how to set the work.

Most of the questions seemed to take me 10-30 minutes to complete, but local storage vec took me about 4 hours (see videos part 1 and part 2) and quizzer took me 4h 40 minutes (see video). Admittedly, I am putting in extra time to write robust tests, but even without that these would have taken me a long time.

More detailed description of lecture/tutorial format

Once we've piloted a module, we should describe the lecture and tutorial formats in more detail, in order for other users of this course to get a better understanding of what we suggest is a good way to provide the content to the students.

Swap out slidev for some rust-based tool

Currently, modmod builds a NodeJS package that uses Slidev to create slideshows out of markdown files. Being a Rust course, it would be nice to depend only on Rust-based tooling, and therefore swap out Slidev for something Rust based.

What we need in a tool:

  • Convert Markdown slides to slideshow
  • Include Markdown files in other Mardown files
  • Support custom themes
  • Be open source (MIT Licensed)
  • Support presenter mode
  • Render to HTML

Decide on quiz platform

  • Nearpod (gratis basisversie, veel mogelijkheden, o.a. gamified en integratie met je slides)
  • Kahoot (gratis basisversie, gamified, kinderlijk?)
  • Socrative ($179.99 USD/year, even navragen of ze dat bij Bratislava al gebruiken, mss kun je een account krijgen)
  • Forms (zal bij het pakket van de uni van Bratislava zitten, als ze ook Teams gebruiken. Voordeel is dat studenten dan automatisch ingelogd zijn en je het makkelijk in een voor hun bekende omgeving kunt integreren. Nadeel is dat antwoorden van open vragen visueel slecht weergegeven worden)

Tracking Issue: A0 module for First Language-Learners / Refresh on Low-Level Concepts

This tracks the progress of the A0 module, which aims to help bridge the gap for two target groups to move onto A1. The groups that are targeted:

  1. Students learning Rust as their first programming language
  2. Students who know high-level programming languages but are unfamiliar with low-level concepts

This should really represent an optional course that can be included in specific situations. It could serve as a resource for students or provide exercises to study specific low-level concepts.

This was proposed and discussed in #18.

Module Content

This is a list of things this module should aim to teach. This is not necessarily ordered.

  • Hello World in Rust
  • Input / Output
  • Variables
  • Branching
  • Loop Conditions
    • For (Each)
    • While
    • For Each
    • Break Loop
  • Static Typing
    - Binary and Variables in Memory
    - Bit operations
    - Signed integer
    - Unsigned integer
    - String
    - Boolean
    - Arrays
    - Tuples
    • Structures
  • Functions
    - Parameters & Return value
    - Recursion
  • Stack and Heap
  • Copy-by-Reference versus Copy-by-Value

Slides

The slides on a specific concept should focus the rough structure:

  1. General overview of the concept. Gives an intuition for the student, but probably too abstract to apply.
  2. Several examples. These should increase in level. Try to find some quite complicated examples that really test the understanding of the student.
  3. Last quick summary of the concept.

Exercises

The module contains many small and rewarding exercises to teach. All of these exercise should be on the Rust Playground and try to really focus on a specific concept per time.

What this module does not contain

  • Operating System concepts
    - System-Calls
    - Low-Level Memory Management
  • An exploration of the standard library. Talk about Box and Vec but nothing else.
  • Compilers
    - CLI interaction with cargo or rustc

Useful Reference Resources

Add a teacher's companion

To allow teachers to more easily get started with Rust 101, add a teacher's companion to the course. The teacher's companion should describe which modules can be used for different situations and target audiences, and describes per module how it should be taught, how much time we estimate the module takes, and where to find background information on the module subjects.

Notes on Course Material

Hey, I decided to look through the Course Material and have some questions and comments which hopefully can help the course forward. Overal I agree with most of the structure.

Target Audience

What is the actual target audience of the course? Is it targeting first year's students or students later in their university life? My current impression is that is trying to target both, which is fine but is probably quite a lot more difficult.

To deal with these differences in the audience experience, it may be interesting to provide a block with most programming syntax and semantics sections with 4-5 tabs. This should try to explain it which the readers specific context and give the professors good resources depending on the context at the university.

One tab should explain the concept as if the reader has no programming experience, others should explain it as if the reader is coming from a specific programming language. As far as I know the most common languages to learn first at university are C, Python, Java and JavaScript. We can compare basic concepts to how they are in those languages.

A1

The A1 module mostly seems fine to me. One of the parts I maybe agree a bit less with is the Move Semantics. Personally, I would take this chance to explain the rationale for the Borrow Checker and also explain the Drop semantics (not the Drop trait). I feel like most people would agree this is one of the major mechanisms that sets rust apart from other programming languages and having people familiar with it seems like something you want to do as soon as possible. Later you could link back onto this and explain things in a little more detail. Meanwhile students may connect some dots and detect some patterns themselves.

Some others small things:

  • rustc --explain is really useful
  • Some exercises with theoretical questions about the borrow checker

A2

This is probably the module I have the most comments about.

  • Personnally, I would explain lib vs bin and the module system in this section as I feel like they are both extremely vital to looking at any form of rust code.
  • I would move opt-levels and LTO to module B. These things are extremely domain specific and just distract from the important basics. Same for cross-compilation.
  • SemVer is extremely widely used in Rust. It should at least be mentioned here, I reckon.
  • Mention the rustonomicon in module F and not here.
  • Just provide a list of commonly used crates (serde, rand, libc, nix, syn, quote, proc_macro(2)) and explain why not everything is in the std

A3

  • Maybe do mention into & from with the casting but don't explain them detailed as of yet. Just plant the seed that there might be a method that is used in most situations.
  • Maybe add a part about const contexts.
  • Small part on macro_rules! since these are widely used
  • Leave out union here and explain that in F with the unsafe and FFI parts

B

  • Part on normal headers in documentation. Already partly included in Rust API guidelines

C

  • Mention Rayon
  • Maybe reference the book by Mara Bos on the topic

D

  • Explain the different memory models that can be used while programming rust. This is mostly from the Jon Gjengset video on unsafe rust. I do think this is quite important but may take a long time to explain properly. Maybe there are some external resources that do this already and we can link to those.

E

  • Part on WebAssembly

A0

Maybe, it is an idea to have an A0 module that is specifically for universities trying to use Rust as their intro to programming class. This may be out of the scope of this project, let me know.

This module can explain some of the more general and basic programming concepts. This could cover motivations for items and introduce working code without to much explanation as to what they are. Providing a lot of space for the student to infer their own patterns. I need to do more research into how other courses do this, but right now some of the items I think it should introduce are:

  • Variables
    • Numbers (unsigned, signed, floating point)
    • Chars and strings
    • Groups of structures
  • Control Flow
  • Loops
  • Functions
  • Input / Output
  • Compartimentilization
  • Examples of common domains
    • Web
    • Systems
    • Embedded
  • Common problems
    • max / min
    • serialisation
    • parsing
    • sorting

Thoughts

I think it will be very difficult to balance time and what to explain where.

I would love to help writing parts of this course. I would love to hear your opinions on these items and if you agree with some, I can send a PR with those changes. Also, if you would like me to look into some specifics let me know. If you would like to have me start writing on some topic, also let me know. Again, would love to help.

Minor fixes and improvements

A1

  • Slide 7 has a strange list
  • Slide 8: Maybe don't use the embedded link to display on the slide
  • Slide 30: I find it a bit counterintuitive that the first bullet point after the heading “Statements” explains what an Expression is. Maybe move the first bullet point to the next slide, where expressions are explained anyway
  • Slide 34: The light font on the image is hard to read (As I found out later, this is apparently only a problem in the dark mode. If you don't use that, you can probably ignore this)

https://101-rs.tweede.golf/

1.0 - Installation

2.1

  • In the end, you say that exercises/A1/2-move-semantics/01.rs should compile as is, but this is not true, as there is one mut missing.
  • You may want to delete exercises/A1/2-move-semantics/src/main.rs

A2

  • Slide 21: In the subheading, you probably mean 'Structs' instead of 'Enums'?

  • exercises/A2/4-boxed-data/src/main.rs:102 “If you have time let” should be “If you have time left”

  • exercises/A2/4-boxed-data/src/main.rs uses a different syntax ('///') instead of ('//') to explain the exercise

3.B

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.