CSCI3180 Principles of Programming Language - CUHK Course Review

Term Taken: 2020 Spring

Remote Teaching due to COVID19

Instructor: Prof. Lee Ho Man Jimmy

Grading Scheme

  • Programming assignments x4 (60%)
  • Final exam (40%)

Topics Covered

  • Names, bindings, scoping.
  • Data types.
  • Expressions and assignment statements.
  • Statement-level control structures.
  • Subprograms.
  • Declarative programming languages: logic programming, functional programming.


Covered in tutorials:

  • COBOL
  • Python: duck typing
  • Perl: dynamic scoping
  • Prolog
  • ML

Textbook

Concepts of Programming Languages. (Robert W. Sebesta)

This book is required because the final exam is open-book. Though I didn’t have time to even take a glimpse at the book while doing exam.

Review

This is a major required course for Computer Science students. Many people regard this course as difficult and demanding, I don’t know why. I think most of the topics were very interesting and straightforward to understand. The whole course was like extracting all the essence of popular programming languages and discussing the decisions made between different designs. For me, the course was pretty enlightening because though I enjoyed learning new programming languages, I always learned programming languages blindly by following online tutorials. After I took this course, I could fully grasp the essence of a language by understanding the design decisions made by its designers. Also, after the course, many of the terms I’ve heard of but not fully understood gained rigorous definitions. To list a few, “compiled vs interpreted vs hybrid”, “static typing vs dynamic typing”, “subtype polymorphism”, “ad-hoc polymorphism”, “pointer vs reference”, “union type”, “static vs stack vs heap”, “functional programming”, “closure”, etc.


The professors wouldn’t teach you any specific programming languages in the lectures, but in the assignments, we had to write projects using multiple languages. I heard that the languages used change every semester, but for us, it was COBOL, C, Python, Java, Perl, Prolog, and ML. What’s worth noting is that the assignments weren’t designed solely for the sake of learning a new language, they were designed for us to compare some important concepts of programming languages, for example:

Assignment 1: COBOL vs. C

We were only allowed to use GO TO in COBOL (i.e. COBOL in the old way) for loops and control statements, so that we could understand the importance of the introduction of control statements in modern programming languages.

Assignment 2: Java vs. Python

Comparison between duck typing in dynamically-typed languages (Python) and inheritance in statically-typed languages (Java).

Assignment 3: Python vs. Perl

Comparison between static scoping (Python) and dynamic scoping (Perl).

Assignment 4: Prolog vs. ML

Understanding the logic programming and pure functional programming paradigm.


Many people complained that the workload of the assignments were too heavy, I don’t think so. Since all students already knew C, Java, and maybe Python before the course, only about 1-2 hours of tutorial course on the internet was enough to make them understand enough COBOL and Perl to do the assignments. This is because COBOL and Perl are both imperative languages, so coming from C and Java, we already knew the meat of the languages, we just need to learn the syntax of them. ML is also easy in the sense that its exactly like math taught in high school, you just need to shift your mind set and pretend you are writing math equations instead of programming to finish the assignment. Prolog is a little trickier, since most of us had no prior experiences in formal logic. To make it simpler, I usually think of mathematical induction when I wrote Prolog programs (though it was a wrong mindset). For example, when writing a predicate for finding the last element of a list:

element_last(X, [X]).

is just like the base case of induction.

element_last(X, [_|Tail]) :- element_last(X, Tail).

is just like the inductive step. It’s like since element_last(X, Tail) is true, the next step we could obtain is element_last(X, [_|Tail]), which increases the length of the list by 1 (a single step).


Just to rant a bit here. There were two downsides of the course: the quality of assignment specifications and the online exam. Most of the assignment specifications were pretty ambiguous, and it kept on updating after receiving student’s questions on Piazza. That made it a punishment for starting early on assignments, since you never knew whether the code you completed aligned the latest specifications. Also, the templates of assignment code followed very poor naming conventions, we could see both snake_case, PascalCase, and camelCase in a single code base. I think the TAs who designed the homework should know better about the naming conventions of a language and follow good programming practices. The second rant is about the online exam. Due to COVID-19, the professor announced the exam to be taken online, we had to stay on ZOOM with camera and microphone turned on and record a 2-hour long video of ourselves from the side during the whole exam. I knew the professor wanted to make the exam fair for everyone, but I think it was still easy for students to cheat in this way and it simply made students extremely nervous for the exam. (Many of us worried about power shortage, internet disconnection, Windows Updates, and so on while doing the exam.) Also, the exam was divided into two parts with only 40 and 50 minutes for each. Most of the students had to rush to finish the exam, thus making stupid mistakes while panicking.


Still, I think this is a really enjoyable course which lets you solidify your knowledge in programming language design and makes you dabble in multiple interesting programming languages.


P.S. I really wanna become a programming language nerd, but I don’t have the time to go deeper in this field :(

Assignment Link

GitHub


More CUHK Course Reviews