Lecture 10
The End
- Big thanks to the American Repertory Theater for hosting lectures this term, providing amazing props, lighting, and sounds to our stage.
- CS50’s team, too, has been making everything possible off-stage, including our teaching fellows and course assistants, at both Harvard and Yale.
- And even David makes mistakes and can be unsure about answers for some questions, so rest assured that learning will continue well beyond this course.
- Don’t forget that, ultimately:
what ultimately matters in this course is not so much where you end up relative to your classmates but where you end up relative to yourself when you began
- We’ve learned some first principles:
- computational thinking
- using algorithms to solve problems, given some inputs from which to produce outputs
- axes of correctness, design, and style to evaluate our code
- abstraction, using layering to simplify problems, as with functions in code
- precision, as by considering all the possible edge cases in our instructions
- With these basic building blocks, we can learn to use tools in the future, beyond C and Python, to solve even more problems.
- We ask a volunteer to give a series of instructions for how to draw a cube and a snowman, and since everyone else interpreted each instruction slightly differently, the final drawings all ended up very different.
Ethics
- We might think of ethics as whether we should do something, or how we go about doing it, even when we have the ability to.
- For example, we can now use code to send lots of emails, creating more spam. We can collect passwords for our website with a form, and if a user uses that same password for another site, we end up with access to their account unless we store the passwords securely.
- JavaScript, too, can be used to log users’ actions on our sites, like items they’ve added to their cart. But logging all actions, over time, can cause worry for users’ privacy.
- Before Facebook, the website, there was another website, Facemash, where code was used to scrape, or download, images of Harvard students and use them without prior permission.
- With some colleagues from the Department of Philosophy, Meica Magnani and Susan Kennedy, we discuss some frameworks for making decisions more rigorously.
- The Embedded EthiCS program at Harvard integrates tools for ethical reasoning into computer science courses, to help ensure that future computer scientists will be creating and using technology ethically.
- The transcript for this section of lecture, as well as readings for the related lab, have been posted separately.
Looking Forward
- Even without additional courses in computer science, we hope that you’re now equipped to use technology to solve problems in your own domain.
- When we face new problems, we can rely on one or more of these skills:
- asking questions
- finding answers
- reading documentation
- teaching yourself new languages
- CS50 IDE, too, can be used for future projects, but it comes with tools for the course.
- More industry-standard tools, for our own Mac or PC, include a terminal and other command-line tools:
- Brian has a workshop on Git, a version-control software used to manage different versions of code and enable collaboration with others.
- One of the most popular IDEs, VS Code is open-source and freely available, with a text editor at its core and lots of other features that can be added. There are many alternatives as well.
- Web hosts include:
- Web app hosts include:
- And news sources for technology and programming include:
- CS50 has many communities as well:
- https://discord.gg/cs50
- https://www.facebook.com/groups/cs50
- https://www.facebook.com/cs50
- https://gitter.im/cs50/x
- https://github.com/cs50
- https://www.instagram.com/cs50/
- https://www.linkedin.com/groups/7437240/
- https://www.linkedin.com/school/CS50/
- https://www.quora.com/topic/CS50
- https://www.reddit.com/r/cs50
- https://cs50x.slack.com/
- https://www.snapchat.com/add/cs50
- https://soundcloud.com/cs50
- http://cs50.stackexchange.com/
- https://twitter.com/cs50
- http://www.youtube.com/cs50
Quiz Show
- We host a quiz show with the audience, with the following questions:
- What are the steps for compiling source code into machine code?
- Preprocessing, compiling, assembling, linking
- What is the runtime of binary search?
- O(log n)
- Which of these animals was the first to be mentioned in a CS50 lecture?
- Cat
- Every time you
malloc
memory, you should also be sure to…free
- What is a race condition?
- When two things happen at the same time and produce an unexpected result
- Does zooming in on a photo let you “enhance” it to generate more detail?
- No, a photo only has a certain amount of detail
- Which of the following is not a characteristic of a good hash function?
- Randomness
- What does FIFO stand for?
- First in, first out
- Which of the following would represent pink using RGB values?
#ffd0e0
- In C, which of the following lines of code allocates enough memory for a copy of the string
s
?malloc(strlen(s) + 1)
- How should you organize your clothes to be cool?
- queue
- What is a segmentation fault?
- When a program tries to access memory that it shouldn’t
- Which of the following types of overflow can result from recursion without a base case?
- stack overflow
- In the town of Fiftyville, what were the names of the three people who witnessed the rubber duck robbery?
- Ruth, Eugene, and Raymond
- Which of these command-line programs check your code for memory leaks?
valgrind
- Which of the following exists in C, but not Python?
- do-while loops
- What HTTP request method should you use when sending private information, like a password?
- POST
- What data structure allows for constant-time lookup for words in a dictionary?
- trie
- What is a cookie?
- both of the above
- What’s your comfort level now?
- I’m among those more comfortable
- What are the steps for compiling source code into machine code?
- Thanks for joining us at CS50!