Git Product home page Git Product logo

recitations's Introduction

COMS 3157 Recitation Notes

NOTE FOR FALL 2022 STUDENTS: these recitations notes are for the version of COMS 3157 taught by Jae Woo Lee. John, who is teaching it in Fall 2022, is publishing links to his recitation notes directly to this semester's course website. You are still welcome to consult these recitation notes for reference.

This repository contains the recitation notes for Columbia's Advanced Programming class, COMSW3157, as taught by Jae Woo Lee. For more information about the class, visit the course homepage.

These recitations are held weekly by the various TAs, generally using these notes as the basis for their sections. Issues, patches, and comments, especially by current and former students, are welcome.

Contents:

  • Recitation Note A: Introduction to UNIX, compile your first C program.
  • Recitation Note B: Makefiles.
  • Recitation Note C: Configuring and using Git for version control and file tracking.
  • Recitation Note D: Bits, Binary, and C Basics
    • Bits & Binary: Two's complement, bitwise operators, and Boolean logic.
    • C Basics: syntax, data types, expressions, and statements.
  • Recitation Note E: Parts of memory, pointers, and arrays. (i.e. malloc).
    • See also the very useful code directory, especially pointerfun.c and its output pointerfun-output for some interesting experiments with pointers and memory addresses.
  • Recitation Note F: Function pointers.
  • Recitation Note G: Structs, Unions, Const, C strings.
  • Recitation Note H: Linked lists and similar data structures (REMOVED).
  • Recitation Note I Using GDB and valgrind for debugging.
  • Recitation Note J: The UNIX stack. Users, permissions, file attributes. Processes, forking, and signals.
    • See also jsh, the Jae shell, in the code directory for a fun example of forking.
  • Recitation Note K: size_t. File IO, including reading, writing, and seeking in files.
  • Recitation Note L: Interprocess communication: pipes, FIFO, and sockets. TCP/IP stack information and netcat basics.
  • Recitation Note M: C++ intro. Classes and structs. Stack vs heap allocation in C++. The basic 4. Implicit conversion and operator overloading.
  • Recitation Note N: C++ generics, templates, containers, metaprogramming.
  • Recitation Note O: Smart pointer explanation.
  • Recitation Note Z: Bonus recitation -- Unix 2.

Additionally you can read the Mid-Semester Review to brush up on past material in the first part of the course; or Mid-Semester Review 2 for the second part (ie up to basic C++).

Finally, we've collected a number of interesting articles, posts, etc about C and related stuff in the reading list.

recitations's People

Contributors

akalicki avatar andylhxu avatar aunoyp avatar chaiwen avatar chmullig avatar cjubb39 avatar elshadaib avatar gahdritz avatar garymlin avatar gitskim avatar goldvictuuri avatar hmontero1205 avatar j-hui avatar jamesyang916 avatar jl3953 avatar joshuazweig avatar jrbalsano avatar kaitlinhuben avatar kevin1 avatar kl2532 avatar kl2792 avatar kugurst avatar luo-anthony avatar mvankeulen94 avatar mychrisdangelo avatar nsgomez avatar ohemily avatar themost1 avatar tzussman avatar xurxo-riesco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recitations's Issues

Unclear explanation of incrementing an array vs a pointer

This paragraph is not clear, even though it covers an important distinction:

"In most cases, just calling an array by its variable name without the square brackets will be interpreted as a pointer to the first element of the array. Incrementing a pointer will always move it ahead by the number of bytes making up the type to which it's pointing. In other words, incrementing a pointer makes the pointer move by the size of the type. In this case we're dealing with a pointer to an int, so the pointer will move by 4 bytes to the next int. Unlike a pointer, though, an array is a constant variable (see the code snippet above for how that affects p++ and a++)."

I'll try to find time for fixing this but if anyone else has time, please see if you can word it in a less confusing way!

Better code demos/examples

I think we could create more coding "usable", standalone coding examples that students can clone and play around with. We can choose to use any number of them during our recitations to supplement our "lecturing" (i.e. reading off of notes), rather than talk about them abstractly as snippets embedded within our long-form notes.

Another side discussion is about whether or not we want to include Makefiles with those notes โ€“ on one hand, I think it's at least a common courtesy, and we should hold ourselves to our own standards as far as distributing code with Makefiles (plus, we can include cool alternative compilation rules, like make debug or make alternate which can define different pre-processor variables), but on the other hand, since this stuff is public, I'm wondering if security/giving away the answers is a problem.

What are your thoughts?

while input redirection works, echo doesn't take stdin

/K-File-IO/file-io.md states the following:

For example, after running the example above, echo < hi.txt will print "hello world" to the console.

Running this command produces the same output as echo with no arguments, instead of the expected output. A more suitable example might be cat < hi.txt ?

Typos and Misinformation

  • In recitation 3 and 8 it should say 2^8 on line: "8 bits form a single byte: 11111111 = 2^7 - 1 = 255"
  • In recitation 3 and 8 the line "(0177777 == -1); //returns 1 (true)" should be changed to use a 32-bit integer for this octal representation.
  • In recitation 5, the sample code for a tree using the "Node" struct should use the reference operator, not the actual values.
  • In recitation 4 code, strcpy function has an incorrect comment. p and p2 point one past the null at the end of the string by the end.
  • There is a spelling error in recitation 2, digression section, first sentence, "grea"
  • Recitation 4 code, increment incorrectly reports the final value

[NoteA]

Should add something about ~ when talking about relative paths. This seems to be a point of confusion.

Clarify fgets vs fread

Many students remain confused about which to use. We should do a better job of explaining what's different between them.

sizeof confusion: drive home that it's done at compile time

So many people are super confused by sizeof, and use it where they shouldn't. for example, in place of strlen. It might help some to emphasize that sizeof is (normally 1) an operator evaluated at compile time, and becomes a constant. So it doesn't know. See K&R pgs 135, and to a lesser extent 203, for more.

  1. Note this breaks, slightly, with C99 variable length arrays where sizeof acts like an expression, not a constant. (invalid in the C++ spec as far as I can tell)

L-tcpip

We should add discussion about the server/client TCP/IP diagram to these recitation notes.
It is really crucial for the students to understand this for lab6, 7

Additionally, notes L contains information about interprocess communication, which I don't believe we cover. I think that it should more generally move to cover tcp-serv, tcp-recv, the new way we're teaching these concepts.

Reiterate HTTP specification

Peeps struggle with the HTTP spec - we should come up with an exercise or something to really drive home what's strict, and who can cheat and be ok.

Fork without if/else

Currently no examples of forking without if/else right afterward. It would be important to demonstrate that this is a possible use of fork in some way.

Organization Should be By Topic

What do you guys think about this? I was thinking about this the other day and realized that for all the shifting around of existing topics we do it might just make more sense to split all the files out into their own topics. We could outline which topics would be covered which week in the README.md file instead.

Note H contradicts lab3 instructions

Note H on reverseList:

Perhaps a simpler method is to create a temporary list. Traverse through the original list and then add each node to the front of the temporary list. The temporary list will be the reverse of the original list. Of course, there's an equivalent method that doesn't involve traversal, but still uses the same fundamental idea.

mylist.h in the lab skeleton:

Note that this function reverses the list purely by manipulating pointers. It does NOT call malloc directly or indirectly (which means that it does not call addFront() or addAfter()).

Show with/without debugging symbols example

In OH someone was having issues with their program, and they didn't find valgrind helpful. Well it turns out they were manually running gcc whatever.c and then just running ./a.out for testing. "I'll get to the makefile later." Of course without adding -g there were no debugging symbols, so the valgrind errors just had random hex garbage.

This suggests we should more comprehensively show an example of how much debugging symbols (and warnings) can help. Perhaps combine with the gdb example?

Recitation Note D link broken

All the hyperlinks in the main README to "Recitation Note _" jump to a text file (that I have seen so far). That is, except for the link for section D. Not a major functionality issue, but I would expect that this isn't something too hard to fix.

File descriptor vs. FILE pointer distinction needs to be made

The section in Notes K on FILE pointers and file descriptors needs to be rewritten. It's a jumbled mess that doesn't make the proper distinction between a file descriptor (the integer used by write, etc.) and a FILE pointer (the FILE * type used by fwrite, etc.).

This is a super confusing topic for students and our recitation notes need to be correct and precise. I don't have time to do it right now, but fixing this should be a very high priority.

GDB

GDB is not really covered in any of the earlier recitations. We should probably address this earlier on when students start debugging their first assignments.

I-Debugging-GDB/gdb.md a possible typo

Between Memory Errors and Lost Memory, there's this sentence:

The compiler won't warn you about it in any non-trivial case.

It seems that it should be "the compiler will warn you...".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.