Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A0 module #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

coastalwhite
Copy link

@coastalwhite coastalwhite commented Jan 28, 2023

An PR that adds the A0 module that provides a general introduction into programming with a statically typed programming language.

This PR is far from finished, but in the end resolves #25.

@coastalwhite
Copy link
Author

Hey,

Didn't have much time over the last few weeks, but I finally got time to finish at least a first draft of this.

I think the slides provide a good introduction into programming and for the next lecture, although it may still be a bit daunting. It may be a good idea to supply some more external materials, but it might just be an idea to have an additional document supply this to the lecturer.

As for the exercises, I feel like the tweedegolf GH organization should create the gists of them and provide links to the play.rust-lang.org with that gists. This way they don't need the development environment just yet. Please let me know what you think and which things can be improved.

@coastalwhite coastalwhite marked this pull request as ready for review March 19, 2023 11:06
@coastalwhite
Copy link
Author

coastalwhite commented Nov 14, 2023

I will just add some of the planning I did for the reworking of this module based on the meeting we had.

Essentially, we will divide the A0 (which we might want to give a different name now) into 9 topics. Starting from absolute zero to the point where they can build a simple calculator and know most basic programming concepts. I have also listed exercises that might be used for the topic.

Some notes:

  • It might be interesting to add a small integration project where people do a bit of file manipulation. For example, a small HTML page generator would probably be very cool for the graphically inclined people. This would not require too, too much extra explanations.
  • On some parts (e.g. Vec, Box, String, modules and CLI), I would want a minimal explanation to pragmatically use those concepts rather than actually fully describing those topics. For that, there are either already topics or it is not relevant.
  • The reddit thread came up with the idea of just using modules to simulate multifile projects. I did not go with that approach here. Instead, I try to explain very basic concepts for CLI. This needs to be independent of target platform.

A0.0: Introduction to Programming Concepts

Content:

  • What is a programming language?
  • Hello World!
  • Comments
  • Variables
  • Conditionals
  • Lists and loops

Exercises:

  • Printing your name
  • Print all numbers in a list
  • Print all numbers on the same line, separated by comma's
  • Print all even numbers

A0.1: Types

Content:

  • Boolean
  • Numbers (Integers, Floating-Point)
  • Text
  • Ranges
  • Composition structures

Exercises:

  • Annotate a file with types
  • Use ranges to print all letters
  • Define a few structures with several constraints

A0.2: Dividing and Conquering

Content:

  • Why divide-and-conquer?
  • Functions
  • Associated Functions
  • Methods

Exercises:

  • Define a set of functions to fill in triple, receprical, exclusive_or, ...
  • Define a new function for a EvenNumber structure
  • Define a is_sum_equal_to function for a TwoNumbers

A0.3: Scopes and global variables

Content:

  • Scopes
  • Mutation
  • Constants

Exercises:

  • Annotate which variables are in scope
  • Solve the mutation flag of a few functions
  • Keep a loop index and skip every other element, skip the last element
  • Extract constants

A0.4: Memory

Content:

  • Overview of memory
  • References
  • Stack
  • Heap (Box, Vec, String)

Exercises:

  • Define stack content
  • Annotate heap versus stack
  • Create a vector with all numbers divisible by 7

A0.5: Inputs and Outputs

Content:

  • Standard Library (very brief!!!)
  • Printing
  • Reading input

Exercises:

  • Take user's name and print a hello message back to them
  • Integration exercise: Random Number guessing game
  • Integration exercise: Calculate the day at which someone was born

A0.6: Command Line and Introduction to Cargo

Content:

  • Basics of the command line
  • Creating a new project
  • Running your project

Exercises:

  • Show them usage of a few very basic commands cd, ls/dir, cat/type
  • Guide users through creating their own project

A0.7: Modules and Multi-file projects

Content:

  • Modules
  • Use statements
  • Public and private
  • Projects with multiple files

Exercises:

  • Calling print from multiple files
  • Implement an EvenNumber struct that cannot contain invalid state

A0.8: Intermediate Programming Concepts

Content:

  • Bits and bit operations
  • Recursion
  • Enums
  • Tuples
  • Copy-by-value and Copy-by-reference

Exercises:

  • Implement a is_power_of_two, div_by_2 and times_by_three
  • Implement factorial for recursion
  • Define your own Option enum
  • Return two values with tuples div_and_remainder
  • Annotate copy-by-value and copy-by-reference

Final Project

Integration: Guide student through building a small polish notation calculator

@coastalwhite coastalwhite reopened this Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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