Summary and Schedule
Melissa and her schoolmates built a trebuchet in their physics club. In their first tests they experienced that aiming it is not very easy or intuitive, so they are planning to write a program that automatically aims their trebuchet given the distance of the target and the velocity of the wind.
As for the programming language, they chose Julia since it has state-of-the-art packages for this task and they also read it composes very well. Unfortunately nobody knows this language already, so they have to learn it from scratch.
- Understand the concepts of files and directories as well as arrays and indices.
- It is beneficial to have some programming experience in another language.
- This course requires Julia 1.6 or greater
| Setup Instructions | Download files required for the lesson | |
| Duration: 00h 00m | 1. Part I: Introduction to Julia | |
| Duration: 00h 00m | 2. Introduction |
What is Julia? Why use Julia? |
| Duration: 00h 05m | 3. Using the REPL | How to use the REPL? |
| Duration: 00h 30m | 4. The Julia Type System |
What is the use of types? How are types organized in Julia? |
| Duration: 00h 50m | 5. Using the Package Manager |
Where do I find packages? How do I add packages? How can I use packages? |
| Duration: 01h 10m | 6. Part II: Programming in Julia | |
| Duration: 01h 10m | 7. Write functions! |
How do I call a function? Where can I find help about using a function? What are methods? |
| Duration: 01h 30m | 8. Interfaces & conditionals |
How to use conditionals? What is an interface? |
| Duration: 02h 30m | 9. Loops |
What are for and while loops? What is a comprehension? |
| Duration: 03h 30m | 10. Part III: Managing Julia Projects | |
| Duration: 03h 30m | 11. Using Modules | What’s the purpose of modules? |
| Duration: 03h 45m | 12. Creating Packages | How to create a package? |
| Duration: 04h 15m | 13. Adding tests |
What are unit tests? How are tests organized in Julia? |
| Duration: 04h 55m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Software Setup
Details
This lesson requires installation of the following components:
- terminal emulator (“shell”);
- the version control software “git”;
- a text editor (either “VSCodium” or “nano”), and;
- Julia.
Git and Bash
- Download the Git for Windows installer.
- Run the installer and follow the steps below:
- Click on “Next” four times (two times if you’ve previously installed Git). You don’t need to change anything in the Information, location, components, and start menu screens.
- From the dropdown menu, “Choosing the default editor used by Git”, select “Use the Nano editor by default” (NOTE: you will need to scroll up to find it) and click on “Next”.
- On the page that says “Adjusting the name of the initial branch in new repositories”, ensure that “Let Git decide” is selected. This will ensure the highest level of compatibility for our lessons.
- Ensure that “Git from the command line and also from 3rd-party software” is selected and click on “Next”. (If you don’t do this Git Bash will not work properly, requiring you to remove the Git Bash installation, re-run the installer and to select the “Git from the command line and also from 3rd-party software” option.)
- Select “Use bundled OpenSSH”.
- Ensure that “Use the native Windows Secure Channel Library” is selected and click on “Next”.
- Ensure that “Checkout Windows-style, commit Unix-style line endings” is selected and click on “Next”.
- Ensure that “Use Windows’ default console window” is selected and click on “Next”.
- Ensure that “Default (fast-forward or merge) is selected and click”Next”
- Ensure that “Git Credential Manager” is selected and click on “Next”.
- Ensure that “Enable file system caching” is selected and click on “Next”.
- Click on “Install”.
- Click on “Finish” or “Next”.
- If your “HOME” environment variable is not set (or you don’t know
what this is):
Open command prompt (Open Start Menu then type
cmdand press Enter)Type the following line into the command prompt window exactly as shown:
cmd setx HOME "%USERPROFILE%"Press Enter, you should see
SUCCESS: Specified value was saved.Quit command prompt by typing
exitthen pressing Enter This will provide you with both Git and Bash in the Git Bash program.
Nano
nano is a basic editor and the default that instructors use in the workshop. It is installed along with Git.
Julia
- Open a web browser and visit the Julia download page
- Download the Current stable release for Windows by clicking the 64-bit (installer) link.
- Run the installer once it finishes downloading.
- Click on Next to accept the default directory (or after specifying your preferred installation location).
- On the Select Additional Tasks screen under Other, check the box to Add Julia to PATH.
- Click Next.
- Click on Finish.
We will run Julia through the Git-Bash interface. Once you have it installed:
- Open the Start menu and click on the Git folder.
- Click on Git Bash – not Git Cmd!
- A warning message might pop up about a missing icon: click “I see,” and continue.
- Once the terminal window loads, type julia and enjoy the lesson!
VSCodium
- Install VSCodium for your platform
- Start VSCodium
- Inside VSCodium, go to the Extensions view by clicking View on the top menu bar and then selecting Extensions.
- In the Extensions view, search for the term “julia” in the Marketplace search box, then select the Julia extension (julialang.language-julia) and select the Install button. This will add Julia to your VSCodium and automatically link the text editor to your copy of Julia you installed earlier.
- Restart VSCodium.
Then, test that everything works:
In VSCodium, create a new file by clicking File on the top menu bar and selecting New File.
-
Inside the file, type
Save your file by clicking File on the top menu bar and selecting Save. Name your file
hello.jl.Run your file by first pressing Ctrl+Shift+P to bring up a command palette for search all commands available in VSCodium. Then type
Julia: Execute active file in REPLin the command palette and press Return.If everything works, you should see a message “Hello World!” appear.
Bash
The default shell in some versions of macOS is Bash, and Bash is available in all versions, so no need to install anything. You access Bash from the Terminal (found in /Applications/Utilities). See the Git installation video tutorial for an example on how to open the Terminal. You may want to keep Terminal in your dock for this workshop.
To see if your default shell is Bash type echo $SHELL in
Terminal and press the Enter key. If the message printed does
not end with ‘/bash’ then your default is something else and you can run
Bash by typing bash.
If you want to change your default shell, see this Apple Support article and follow the instructions on “How to change your default shell”.
Git
For macOS, install Git for Mac by downloading and
running the most recent “mavericks” installer from this
list. Because this installer is not signed by the developer, you may
have to right click (control click) on the .pkg file, click Open, and
click Open on the pop up window. After installing Git, there will not be
anything in your /Applications folder, as Git is a command
line program. For older versions of OS X (10.5-10.8)
use the most recent available installer labelled “snow-leopard” available
here.
Nano
nano is a basic editor and the default that instructors use in the workshop. See the Git installation video tutorial for an example on how to open nano. It should be pre-installed.
Julia
juliaup:
-
Run:
curl -fsSL https://install.julialang.org | shOr, if you want to use homebrew:
brew install juliaup
Manual:
- Download the current stable release from the Julia download page and follow the installation instructions.
VSCodium
- Install VSCodium for your platform
- Start VSCodium
- Inside VSCodium, go to the Extensions view by clicking View on the top menu bar and then selecting Extensions.
- In the Extensions view, search for the term “julia” in the Marketplace search box, then select the Julia extension (julialang.language-julia) and select the Install button. This will add Julia to your VSCodium and automatically link the text editor to your copy of Julia you installed earlier.
- Restart VSCodium.
Then, test that everything works:
In VSCodium, create a new file by clicking File on the top menu bar and selecting New File.
-
Inside the file, type
Save your file by clicking File on the top menu bar and selecting Save. Name your file
hello.jl.Run your file by first pressing Ctrl+Shift+P to bring up a command palette for search all commands available in VSCodium. Then type
Julia: Execute active file in REPLin the command palette and press Return.If everything works, you should see a message “Hello World!” appear.
Bash
The default shell is usually Bash and there is usually no need to install anything.
To see if your default shell is Bash type echo $SHELL in
a terminal and press the Enter key. If the message printed
does not end with /bash then your default is something else
and you can run Bash by typing bash.
Git
If Git is not already available on your machine you can try to install it via your distro’s package manager.
For Debian/Ubuntu:
sudo apt-get install git
For Fedora:
sudo dnf install git
Nano
nano is a basic editor and the default that instructors use in the workshop. It should be pre-installed.
Julia
juliaup:
-
Run:
curl -fsSL https://install.julialang.org | sh
Manual:
- Download the current stable release from the Julia download page and
unpack the folder to any location that is in your
PATHor link the binary in thebinfolder to such a location.
VSCodium
- Install VSCodium for your platform
- Start VSCodium
- Inside VSCodium, go to the Extensions view by clicking View on the top menu bar and then selecting Extensions.
- In the Extensions view, search for the term “julia” in the Marketplace search box, then select the Julia extension (julialang.language-julia) and select the Install button. This will add Julia to your VSCodium and automatically link the text editor to your copy of Julia you installed earlier.
- Restart VSCodium.
Then, test that everything works:
In VSCodium, create a new file by clicking File on the top menu bar and selecting New File.
-
Inside the file, type
Save your file by clicking File on the top menu bar and selecting Save. Name your file
hello.jl.Run your file by first pressing Ctrl+Shift+P to bring up a command palette for search all commands available in VSCodium. Then type
Julia: Execute active file in REPLin the command palette and press Return.If everything works, you should see a message “Hello World!” appear.