Halfway There

Mar 9, 2013, 9:44 PM

[I wrote the following note to my students when I was a TA for CIS240 at the University of Pennslyvania.]

Just two short months ago, you came into CIS240 thinking that your iPhone is powered by the sheer willpower of Steve Jobs. However, now you conceptually understand how transistors work and how p- and n- type transistors come together in CMOS circuitry to form logic gates. You understand how they can be used to form useful things like D-flip flops to store state and adders to add those stored numbers. You learnt 2’s-complement as a method of interpreting those numbers, and you understand how a 16-bit instruction can dictate control signals to a simplified processor. Finally, you understand how the commands of Assembly provide a thin layer of English abstraction over those binary instructions. So we still don’t know exactly how iPhones work, but we can start to see how the iPhone’s processor performs basic operations like arithmetic, predicate logic and memory storage.

A main theme of this course is abstraction. We understand p-mos and n-mos, so now we abstract with lines and circles. We understand D-Flip Flops, so now we draw boxes with triangles. We understand control signals, so now we use Assembly to instruct our LC4 processor in its computations. Looking forward into the second half of the semester, we will use our understanding of Assembly to see how C is yet another layer of abstraction over our increasingly complex model of computation. Yet, we are still a far cry of the comforts of a cozy Java IDE. When you want to deal with Strings in Java, you just go about your business creating, concatenating and substringing like it was a god-given right. Well, in C you are your own god and you’ve got to keep track of how and where you store every single character of your 16-bit ASCII String. And remember the friendly Java garbage collector that you never quite understood but was told to be thankful for? Well now you’re going to be truly thankful for it, because in C you are your own garbage collector and you better not lose track of what memory is stored where or you’ll be haunted by a pesky Segmentation Fault for hours.

If you have been struggling in this class thus far, don’t worry: most of the points of the class have yet to come. You have plenty of chances to redeem yourself. If this class has been easy for you, also don’t worry: it is about to get much more interesting and challenging. For most of you, the biggest challenge will be the sheer amount of code you will be expected to write on your upcoming homeworks. Up till now, you may have gotten away with starting your 240 homework the day it was due. This will no longer be possible. You cannot simply write hundreds of lines of code in a language you’ve barely know with error messages that will make you nostalgic for the Java tracebacks you used to hate. Be prepared to spend 10-15+ hours a week on 240 homework very, very soon.

We hope you all had a great, relaxing break and that you’ll all excited to be heading back. We can’t wait to teach you guys some C!