0% found this document useful (0 votes)
32 views38 pages

SDMS24 Rust Intro

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views38 pages

SDMS24 Rust Intro

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

SDMS 2024

Exercise & Lab Intro


18.10.2024

1
Organizational

2
Course Logistics
• Lecture: Tuesday 15:20-17:00pm in S202/C205 (here)
• Exercise: Friday 9:50-11:30am in S202/C205 (here)
• Exercise Sheets: Preparation for Final Exam
• Programming Labs (Graded): Practical Implementation of
Concepts in Lecture

Prerequisites:
• Solid programming skills (Rust, C++, Java, …)
• Lecture “Information Management” or equivalent (Intro to Databases/SQL)
• Enough time to work on course assignments (i.e., labs) during semester

3
Grade
60 / 100 Points 40 / 100 Points

Written Exam Graded Programming Labs

60 minutes Lab 1: 15 Points


Lab 2: 15 Points
Date: 20.02.2025 Lab 3: 10 Points

Based on ratio of passed tests

Up to 8 Bonus Points
Lab 0: 2 Points
Lab 1,2,3 Up to 2 Points each (Performance)

~50 non-bonus points overall needed to pass the course.


4
Written Exam
● Exam questions based on lecture and exercises
○ Similar to the exercise sheet tasks
● Duration / Points: 60 Minutes = 60 Points
● Closed-book
● No additional notes, no calculator
● Date: 20.02.2025
○ If you can not attend in person, contact us

5
Exercise Sheets aka Paper-Based Exercise
● Handed-out every 1-2 weeks (first one next week)
● Solution discussed during the exercise sessions, published afterwards
● Tasks are meant to (roughly) mimic possible exam questions
● Not handed-in, not graded!

6
Programming Labs
Goal: Implement major building blocks of a scalable data systems
(based on concepts discussed in the lecture)

• We will have 3 programming labs with 5-6 weeks time per lab
Plus a warm-up lab starting next week, awarding 2 bonus points (Lab 0)
• Labs have to be solved individually
• We provide a minimal code framework and tests to check your implementation

7
Programming Lab Infrastructure
● Gitlab is the central piece of programming lab infrastructure
○ Code repository for stencil and student projects
○ Automated test pipeline when changes are pushed
● Link to Gitlab: https://tg.dm.informatik.tu-darmstadt.de/
(Registration is detailed on later slide)

8
Programming Lab Infrastructure
General process:
• Fork stencil project (from group sdms_ws2024_students into own namespace)
• Develop and test locally (we provide set of basic tests in stencil project)
• Push code to your forked repository
• Test pipeline will evaluate your code (Basic tests, Advanced Tests, Benchmark)
• You can push as often as you want, the best version will be graded (highest
number of passed tests)
More details + demo next Friday!

9
Programming Lab - Evaluation
Basic Tests (Step 1) Advanced Tests (Step 2)

● Test Code is provided in stencil, so local ● Only test description is provided


testing is possible/encouraged
● Tests are run when you push to your Gitlab
● Tests are also run each time you push to your repo, if basic tests are passed!
Gitlab repo
● Test Results are shown in the
job log (e.g. click red/green
icon next to last commit)

Points are based on number of passed basic and advanced tests!


The ratio of passed tests is translated to points.
E.g. 20 passed tests of 30 total tests leads to 10 of 15 total points being awarded.
10
Programming Lab - Benchmarks (Step 3, Bonus)
● Lab 1, 2 and 3 will have a third evaluation step, benchmarking a part of the
implementation
● Based on your code’s performance, you can claim up to 2 bonus points per
lab (details to be announced at start of Lab 1)
● Public leaderboard to track your performance:
https://tg.dm.informatik.tu-darmstadt.de/leaderboard

11
Programming Lab Infrastructure Signup
● ASAP: Join the Moodle Course
○ Make sure your Moodle profile contains your matriculation number in the “ID-Number”
Field, e.g. “1234567”, not your TU-ID “ab12cdef“ or anything else
○ If the field is empty, fill it in. If it contains something else contact the Moodle admin
([email protected]) to get it fixed
● During the next week, you will receive an Email telling you to set up a
password to complete your Gitlab account creation
● The Gitlab is only reachable inside the University VPN! VPN HowTo

12
Course and Exam Registration
Registration in TUCaN for Exam/Labs („Prüfungsanmeldung“):

● You need to register for the exam before you hand in the first graded
programming lab (Lab 1)
○ The registration will likely show multiple examination dates, one for each lab plus the exam
● Registration deadline: 12.12.2024
● No de-registration after deadline possible!

13
Rust Introduction

14
Goal/Assumptions
● Not a Programming or Rust course - i.e., we will not teach you Rust

● Rather: Pointers and hints for “targeted” learning

● Assumption: Increased proficiency throughout the course


=> more advanced concepts will be introduced in later projects

15
Is Rust hard?
I wanted to learn Rust and had this idea:

● I learned how to code before


● I have several other related skills
● Those skill should transfer
● Learning another (programming) language should be easy

Turns out:
● It is different
● It forces you to think
● It encourages you to learn
16
Quick comparison
No JVM overhead or GC pauses.

Much lower memory use.

Zero-cost abstractions.
vs Java ConcurrentModificationException

Pattern matching.

Unified build system.

Dependency management.

Slide Source [1]


No JVM overhead or GC pauses.

Much lower memory use.

Zero-cost abstractions.
vs Java ConcurrentModificationException

Pattern matching.

Unified build system.

Dependency management.

Slide Source [1]


Memory efficiency

Returning a static msg over http

20
Image Source [2]
No GC pauses; lower memory use.

No null pointers.

Nicer error handling.


vs Go Safe concurrency.

Stronger type system.

Zero-cost abstractions.

Dependency management.

Slide Source [1]


GC pauses / CPU overhead

Returning a static msg over http

22
Image Source [2]
No GC pauses; lower memory use.

No null pointers.

Nicer error handling.


vs Go Safe concurrency.

Stronger type system.

Zero-cost abstractions.

Dependency management.

Slide Source [1]


No segfaults.

No buffer overflows.

No null pointers.
vs C/C++ No data races.

Powerful type system.

Unified build system.

Dependency management.

Slide Source [1]


Why Rust
Why Rust (is successful)
● Growth & Industry adoption

Due to improved:

● Safety
● Quality
● Productivity
● Performance

26
Growth & Industry adoption

27
Image Source: https://strapi.io/blog/rust-vs-other-programming-languages-what-sets-rust-apart
Growth & Industry adoption

28
Safety

29
Source: https://www.memorysafety.org/docs/memory-safety/
Safety & Quality

30
Source: https://www.youtube.com/watch?v=QrrH2lcl9ew
Productivity

31
Source: https://www.youtube.com/watch?v=QrrH2lcl9ew
Performance

32
Image Source: https://www.figma.com/blog/rust-in-production-at-figma/
Learning Rust
Mental model for learning Rust
● Embrace the compiler and tools
● Just in time learning
● Keep it simple
● You pay the costs upfront
● Be open - “re-learn programming/coding”
○ Data-driven-design vs. Object-oriented-programming
○ Functional programming vs. imperative programming

34
The Rust journey
1. Fight it
2. Almost lose it
3. Agree with it
4. Embrace it
5. Understand it

35
Adopted from: https://jondot.medium.com/my-key-learnings-after-30-000-loc-in-rust-a553e6403c19
Learning Resources
● https://doc.rust-lang.org/book/ (https://rust-book.cs.brown.edu)
● https://google.github.io/comprehensive-rust/
● https://rust-unofficial.github.io/too-many-lists/
● https://cliffle.com/p/dangerust/ (if you have C/C++ background)
● https://doc.rust-lang.org/rust-by-example/
● https://rustlings.cool/
● https://www.rust-lang.org/tools

And many more, e.g., see


https://github.com/rust-unofficial/awesome-rust?tab=readme-ov-file#resources

36
References
● [1] Jon Gjengset, Considering Rust, Feb 2020
● [2] https://medium.com/@dexwritescode/
comparison-between-java-go-and-rust-fdb21bd5fb7c

37
Next Steps
Starting today: Catch up on prerequisites, learn Rust

Now: Join Moodle → Link and check that matriculation number is set up

Next week: Periodically check for Gitlab registration Mail


(also check Spam folder)

Next ex. session: Lab 0 introduction, first paper exercise sheet

12. December: Last possibility to (de-)register for course and exam

20. December: Deadline Lab 1

38

You might also like