CSE 374, Lecture 25: Wrapup
We've covered a lot of ground in 10 weeks! Let's take a look back and review what we've learned (and what might be on the final!)
Linux + The Shell
Why? Because programmers frequently work in the textual environment for its power and customizability.
- Linux model
- Operating system
- File system
- Processes
- Users
- Shell
- Basic commands
- I/O
- Streams (stdin, stdout, stderr)
- Redirection
- Shell variables
- Special characters
- . .. ~
- Filename metacharacters
- Bang
- Aliases
Bash Scripting
Why? Let's automate common tasks.
- Control structures
- Arguments
- Variables
- Exit codes
Regular Expressions
Why? Searching for things is a very common operation.
C Programming
Why? For embedded computing and understanding the rules/systems that underly programs, not just the abstractions hidden by a language like Java.
- The basics: control structures, variables, functions, files
- The stack & the heap
- Address space
- malloc/free
- Variable scope
- Lvalues vs rvalues
- Declaration vs definition
- valgrind
- Types
- Primitives (integer types, floating point types, char)
- Pointers
- Arrays & implicit conversion
- Strings
- I/O (in stdio.h)
- For stdin/stdout
- For file streams
- fopen/fclose
- fprintf/fscanf
- fgets/fputs
- Data structures
- Structs
- Linked lists (HW6)
- Tries (HW5)
- Memory management (HW6)
Why? These are extremely helpful for real-life programming by helping us fix our programs, collaborate with others, automate repetitive tasks, and validate that what we've done is actually correct.
- gcc / compilation
- Preprocessor
- Macros (#define)
- Multifile programs (#include)
- Conditional compilation (#ifdef, #ifndef)
- Compilation stages (preprocessor, compiler, assembler, linker)
- gdb
- The stack
- Basic debugging
- make
- git
- Version control theory
- General workflow
- Testing
- Types of tests
- Coverage
- Black-box vs white-box tests
- Stubbing
Buffer Overflows
- Exploiting unsafe string operations
- Not on the final
C++
Why? It's like C but with some additional pieces.
- What looks similar, what looks different from C
- Easy I/O
- References (easy pointers)
- Classes
- new/delete (constructors/destructors)
- Inheritance (virtual)
Concurrency
Why? In the real world, Moore's law means that in order to go faster, we need to use more cores. How do we not break in that environment?
- Parallelism
- Race conditions
- Bad interleavings
- Data races
- Simultaneous write/write or read/write
- Locks
- Deadlocks
- Best practices
The Final
What types of questions might you see on the final?
- About 9-10 questions, approximately proportional to the time we spent on things in lecture, DEFINITELY including:
- 0-1 from the midterm
- 2 with C programming
- 4-5 from the "tools section"
- 1-2 on C++
- 1 on concurrency
- From the midterm
- Shell commands/aliases
- Bash scripting
- C pointer mystery
- May be incorporated into the other questions, especially in the tooling section
- NOT regular expressions/grep/sed
- C Programming
- malloc/free
- Write a small function to do X.
- What does this program output?
- What's correct/incorrect about this function?
- Linked lists
- Add a function to the linked list we did in class.
- Trie
- Add a function to the Trie from HW5.
- Memory manager
- Add a function to the memory manager from HW6.
- Tools
- gcc/compiler
- Preprocessor
- Mystery: what is the output of the program?
- What code does the preprocessor output?
- gcc
- What went wrong?
- Which step (preprocessor, compiler, assembler, linker) is to blame?
- Debugging (gdb, valgrind)
- How do you debug this?
- What is the problem based on this output?
- Fix the error.
- make
- Draw dependency tree.
- Create Makefile.
- Fix Makefile.
- git
- What commands can you use to do X?
- What went wrong in this git session?
- How can you fix this?
- Testing
- Describe/write tests for a previous programming question.
- C++
- Classes
- Implement a class (like Rational, String, BankAccount).
- Inheritance
- Virtual inheritance mystery.
- NOT implementing an inheritance hierarchy
- Concurrency
- Race conditions (interleaving, data race)
- Draw a bad interleaving.
- Describe the race condition in this function.
- Fix race the conditions in this function.
- NOT deadlocks