<!-- title: Welcome to 0112 (September 8, 2021) -->
# Welcome to 0112
## Table of Contents
1. [Welcome to 0112](#welcome)
2. [What makes code "Good"?](#goodcode)
3. [A Historical Example](#history)
4. [Some Logistics](#logistics)
## Welcome
Welcome to CSCI 0112!
Since some may be unable to make it to class today, I've put off presenting technical content until next time. We'll also introduce your TAs next time. Today we're going to do a little bit of discussion, set the stage for the class, and learn about some historical context.
By the way, notes in 0112 contain pauses for in-class exercises where appropriate. So if you're reading these notes without having been in lecture, and you see a collapsible section, don't immediately expand it. Think about the question first! If you don't, you'll be robbing yourself of a chance to participate and learn.
So that you can spot them in the future, answers of this sort will look like the following:
<details>
<summary><B>Think, then click!</B></summary>
Answer here!
</details>
<br/>
The answers I give in lecture notes are frequently not the <i>only</i> reasonable
answer; in class someone often gives a good answer that wasn't in my notes! <B>So don't worry about whether my answer is the same as yours.</B>
## What is "good" code, anyway? <a name="goodcode"></a>
You've probably written several programs before—likely in CSCI 0111. So you're starting to develop a sense of what might make a program "good" or not. What do you think makes a program "good"?
<details>
<summary><B>Think, then click!</B></summary>
Frequent answers to this question include:
- readability
- organization
- performance
This semester, we’ll learn how to write programs that are "better" in all of these ways. Since this is a shortened lecture, we won't dive in very deep today, but we'll talk about a useful historical example.
</details>
<br/>
## Landing Humans on the Moon <a name="history"></a>
<p align=center><i>(And returning them safely to the earth!)</i></p>
[Margaret Hamilton](https://en.wikipedia.org/wiki/Margaret_Hamilton_(software_engineer)) was the Director of the Software Engineering Division at MIT’s Draper Laboratory in the 60s. Among other things, she was in charge of the team that developed the in-flight software that ran on the Apollo 11 mission, which took humans to the Moon. She was also one of the inventors of the term "software engineering", which describes the study of how to effectively build reliable software.
How many lines of code would you guess were in the Apollo in-flight system?
<details>
<summary><B>Think, then click!</B></summary>
About 145,000.
</details>
In CSCI 0111, you mostly wrote programs that were less than 100 lines of code or so (usually much less). When writing a program of that size, you might be able to hold the whole thing in your head at once–the whole thing might even fit on your screen! When you’re writing 145,000 lines of code, that’s probably not possible.
Is this a problem? Why?
<details>
<summary><B>Think, then click!</B></summary>
Because software is written by people.
The Apollo 11 team had to be able to reliably think about particular pieces of code in isolation, without worrying about the details of other parts of the code. That's a lot harder than it may sound. In a large system, it's very easy for one component to influence the behavior of another. This means that techniques for developing components in isolation are vital.
If the Apollo 11 team hadn't managed that, lives would have been put at risk.
</details>
An example of this kind of technique: functions! When you write a function that does some particular task, the code you write that calls the function doesn’t need to worry about the function's body. We'll be talking a lot about other similar ideas in 0112.
### What did their code look like, anyway?
By the way, here’s a chunk of the Apollo 11 code we grabbed at random (the source code is available [here](https://github.com/chrislgarry/Apollo-11)):
```
SETWO TC WOZERO # GO SET WORD ORDER CODE TO ZERO.
+1 CA DNECADR # RELOAD A WITH THE DNADR.
+2 AD MINB1314 # IS THIS A REGULAR DNADR?
EXTEND
BZMF FETCH2WD # YES. (A MUST NEVER BE ZERO)
AD MINB12 # NO. IS IT A POINTER (DNPTR) OR A
EXTEND # CHANNEL(DNCHAN)
BZMF DODNPTR # IT'S A POINTER. (A MUST NEVER BE ZERO)
DODNCHAN TC 6 # (EXECUTED AS EXTEND) IT'S A CHANNEL
INDEX DNECADR
INDEX 0 -4000 # (EXECUTED AS READ)
TS L
TC 6 # (EXECUTED AS EXTEND)
INDEX DNECADR
INDEX 0 -4001 # (EXECUTED AS READ)
TS DNECADR # SET DNECADR
CA NEGONE # TO MINUS
XCH DNECADR # WHILE PRESERVING A.
TCF DNTMEXIT # GO SEND CHANNELS
```
What do you notice about this code?
<br/>
<details>
<summary><B>Think, then click!</B></summary>
Here are a couple of the things I noticed:
Almost every line of code has a comment explaining what it’s doing! (The comments are the bits after the # on each line)
Nevertheless, the code is pretty hard to read. It’s written in a very old, very low-level programming language called AGC assembly language.
Luckily, in this class you’ll be working in Python, not AGC assembly language. Python has built-in support for the kinds of software engineering techniques and concepts we’ll learn in the course, like functions. <B>However, clean code with well-isolated components can be written in any programming language!</B>
</details>
<br/>
As an aside: Apollo 11 had 145,000 lines of code. Google has about 2 billion lines of code. Part of what makes that possible is that Google’s code is mostly written in languages like Python, not in AGC assembly language.
## Some Logistics <a name="logistics"></a>
See the webpage for assignment, etc. due dates.
### Accommodations
I want to acknowledge that, although some people are using phrases like "back to normal", this semester isn't normal. Many of you may have just finished your summer semester, and so be starting out in 0112 without a summer rest! Others may be studying while dealing with other worries, like family health or childcare or housing.
You can read more about my accommodations philosphy in the [course missive](http://cs.brown.edu/courses/csci0112/fall-2021/lectures/course-missive.html), but I want to emphasize that I mean it. And, especially right now, I want to make sure that all my students can engage with my courses in a healthy way. If that is ever not the case, reach out. I'll listen.
### Notes on Instructor Wrangling
I am fully vaccinated, and yet will still often wear a mask this Fall, whether or not Brown requires it. I'll do this because some on campus may have existing health problems that put them at high risk, or be unable to take the vaccine, etc. I also want to reduce social pressure against mask-wearing, and acknowledge that "getting back to normal" may not be so simple for everyone. Moreover, I can get pretty bad allergies, and prefer to minimize worries about coughing, etc.
I can sometimes have hearing problems in certain classrooms. (This is a hidden reason why I tend to bounce around and get close to people who are asking questions; I'm not just excited to hear you, but I also just want to hear you!) It can be helpful to watch the speaker's face when they talk, which won't be possible this Fall. Please don't be shy about speaking up, and be patient if I ask you to repeat yourself.
### Any questions? Worries? Goals?
I like to spend some time learning about your goals, needs, and worries about the class. Since I don't know what you're going to say yet, I can't put anything in the notes! But if you didn't get a chance to speak up, I'd be interested in hearing from you.