Day 1
Computing as an Interdisciplinary Toolkit
SoftDes is a class designed to:
-
Introduce concepts in computing, primarily using Python.
-
Give students practice breaking down problems, creating solutions, testing while building, and communicating clearly.
-
Open pathways to courses where computing practices are relevant.
-
Serve as a safe place to learn from missteps.
-
Be an environment where students with no computing experience and those with strong foundations can all develop software design skills.
SoftDes is NOT a class that:
-
Focuses exclusively on coding.
-
Students go through alone, without available help from the teaching team or partner and group projects.
-
Unlocks the formula for traditional silicon valley technical interviews.
-
Only serves people who want to major in Computing.
-
Can cover all content exclusively in class time. Instead, students must keep up with what is asked of them outside of class and seek help when as needed.
Themes covered
Some course that are illustrated (intentionally or inadvertently) in class:
-
Designing software: starting with the study and manipulation (recording, replay, debugging, improvement) of processes. Some of the ideas and techniques are therefore applicable outside of software (in day to day life).
- Optimizing a process:
- Do steps at the same time (in parallel).
- Switch the order of two steps that don’t depend on each other.
-
Creating workflows: processes which can be debugged and optimized.
-
Style practices: such as making one change at a time to a program to make debugging easier.
- Incorporating help: from code libraries, to knowledge sharing communities (stack overflow), to peers, and instructors.
This course teaches several levels:
- Tools such as
git
, GitHub, the Atom text editor, the command line. - Concepts such as variables, functions, recursion, and iteration.
- Skills – how to use the tools against a background of concepts to get stuff done.
- Practices – approaching mastery.
Programming Languages
Learning a programming language is like learning a (non-native) natural language. The first one is difficult. Each new one is easier, with a speed bump if it’s not in the same family as the ones you know. (Going from French to Spanish to Italian is easier than going from French to German to Russian to Japanese.)
Why Python?
- It’s at the intersection of teachable and useful.
- It’s useful both within software engineering (popular for tools, system adminstration, web servers, and big data), and as a tool within the sciences.
On the other hand, Python is slower than most of these (although including its libraries makes this comparison harder), doesn’t run on mobile, doesn’t run on resource-constrained devices (such as the Arduino), and doesn’t run in the browser.
Deciding which language to use is an example of a tradeoff, given a context and constraints. This is an engineering idea.
Python is also a tool that a growing number of hobbyists and professionals who have different dispositions use. You might encounter python examples from communities who want to: leverage programming to be more expressive and make beautiful artifacts; help automate tasks while optimizing for efficiency; or advance knowledge in the sciences - to name a few.
Note that this course changes because the context (coding and Python technology and community) continues to evolve.
Materials
- Our web site is on softdes.olin.edu.
- This is built using the same tools you have access to.
- It will be developed iteratively over the semester.
Activity 1 – Get Started
1. Setup your development environment
Follow the instructions on the Setup Your Environment page.
2. Open a Terminal Window
In this course you will make use of the Terminal program. Press ctrl+alt+T, or launch the Terminal from your Programs menu.
Launching Terminal or (Anaconda) Command Prompt is called “creating a terminal session”.
Typing into a terminal session is called “in a terminal session”, “in a terminal”, or “in the shell”
Typing some text – such as ls
– and then pressing the Enter or Return key, is called “entering command“ or “running command”, where command is the entered text.
3. Explore Python
Enter python
. This starts the python interpreter.
You should see something like this:
Python 3.7.1 (default, Dec 14 2018, 19:28:38)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Details such as the date, and the material inside brackets […]
will differ. The first line should say Python 3.7.x
, where x
is some digit. If it says Python 2.x.y
check in with a NINJA.
The chevron’s >>>
are Python’s prompt. Python is waiting for you to type something. Type 42
and press Enter. You should see something like:
>>> 42
42
Now type 40 + 2
:
>>> 40 + 2
42
Try out using Python as a calculator:
- How many minutes are in a day?
- How many seconds are in a day?
- How many seconds are in a year?
- About how many minutes is 1000 seconds?
- How many minutes old are you?
4. Quitting Python
To quit Python, enter quit()
or press control+d (hold the control key; press the d
key; and then release them in either order).
Activity 2 – Jupyter
1. Create a new directory
In a terminal window, create a new directory: mkdir notebooks
.
Set the terminal session to use that directory: cd notebooks
.
Now this terminal session is “in” the notebooks
directory.
- Enter
pwd
into a shell to find out the current directory for that terminal session. Try this now. - Enter
ls
to see a list of files in the current directory. Try this now – there should be no files, because you are in a newly-created, empty, directory.
2. Launch Jupyter
In the same terminal window, enter jupyter notebook
. This should open a new window or tab in your web browser. The page in this window or tab will show a list of files in the directory. Since the notebooks
directory is empty, it should show an empty list.
3. Create a Notebook
In the New menu, select Python 3
. (Your Python may have a slightly different name, such as Python [default]
or Python [conda root]
.)
Type 40 + 2
into the cell.
Using the icons and the “cell type” popup menu (Code
, to the right of the icons) at the top of the page to do the following:
- Run the Python code (the “Play”, or right triangle, icon). You should see a line
Out[1]: 42
. - Modify the text to read
40 * 2
, and run it again. - Create a new cell. Enter
40 - 2
into this cell, and run it. - Create a new cell. Use the cell type menu to change its type to “Markdown”. Enter the text
Some *italic* and **bold**
. What does running this cell do? - Create a new cell. Leave it as a “Code” cell. Enter the text
Some *italic* and **bold**
into this cell too. What does running this cell do?
4. Quit Jupyter
Press the Save icon (the leftmost icon, that looks like a floppy disk from the 90’s) to save your Jupyter notebook. Close the tab or window.
Find the terminal session that is running jupyter notebook
. Press control-c. (Hold the control key down, and while it is down press c
. Then release them in either order.)
You will see some messages, including Shutdown this notebook server (y/[n])?
. This is another prompt. Answer it by typing y
, and then return.
(Control-c requests that a program that you have started from the terminal, stop. It works on more programs than just jupyter
.)
In the terminal, enter ls
(Linux or macOS) or dir
(Windows). You now see a file named Untitled.ipynb
. The file suffix .ipynb
standards for “iPython Notebook” (“iPython” was the original name for “Jupyter”). It means that the file is a Jupyter notebook.
Going Beyond
- Take the Jupyter tour. Select “User Interface Tour” from the Jupyter “Help” menu.
- Rename your notebook. Verify that the file name changed.
- Select “Keyboard Shortcuts” from the Jupyter “Help” menu. These are alternatives to using the icons and popup menu. Repeat the steps in “Make a notebook” using the keyboard instead of the icons and the cell type menu.
- Read the Markdown cheatsheet (linked to from the course site). Try out different Markdown features.
- Create a new Markdown cell. Try entering
$a^2$
,$$a^2$$
, and$a^2+b^2=c^2$
. What happens if you include these in a paragraph of text?
For Next Time
- Finish setting up your environment and doing any of the activities in this page that you didn’t during class (we don’t expect you to get through all of it in class).
- Complete the assignments posted on Canvas
- Reading Journal 1
- Course entrance survey