Programming Languages is a course intended to teach many important principles in programming with a strong emphasis in functional programming.
Among the most interesting concepts are the contrasts between static and dynamic typing (and type inference), and the contrasts between functional programming and object-oriented programming. But The course covers other fundamental concepts like mutability / immutability, algebraic data types and pattern matching, recursion and tail recursion, first-class functions and closures, high-order programming, currying, modules, parametric polymorphism, thunks and lazy evaluation, streams, memoization, macros, object-oriented inheritance, mixins, and many other interesting topics.
Every week a set of topics is covered in great detail in a series of videos that may have a length between 10 to 20 minutes. The material is released every week as course progresses. The materials covered in the videos are also provided in written format for further analysis and easier reviewing. Every week a homework is made available to the students. The homework consists of a series of exercises of increasing difficulty. Sometimes the homework contains challenge exercises that can be solved for some extra points. In my case, solving every homework took an average time between 4 to 8 hours, and the challenge exercises sometimes took me almost a similar amount time (mostly due to the lack of specification and not necessarily due to their complexity, although they were more complex than the rest of the exercises in the homework).
Students submit their homework and an automatic grading system reviews it by applying a series of tests. The failing tests are reported to the students so that they can fix the problems and resubmit again. Only the first two submissions count for the final grade (an average is used for final grading purposes), although students are allowed to submit as many times as they want. The grading system works pretty well, but there were occasional problems with it that were timely corrected. Perhaps my biggest complaint is that the autograder, many times, does not provided enough information to determine what was wrong with the homework submission and this lead to certain amount of frustration when trying to figure out what to do to solve the problems, above all because only the first two submissions count for the final grade. Particularly for the cases of challenge exercises the information provided by the autograder upon failure of any tests was really scarce.
Also, students are required to submit their homework for peer-reviews. And they are required to peer-review other students’ homework. This exercise is intended to give a broader perspective to the students by means of reading someone else’s code. This way, the student can find better solutions created by others or spot problems in their own solutions, etc. Also, during the peer-review process the right/best solutions for the exercises were shared with all students participating in the reviews. Therefore, doing the reviews was the best way to find out the answers to all exercises in the homework.
On week 4 and week 8 the students take an online exam consisting in questions with multiple selection answers. The questions are based on the topics covered in previous weeks. Some of the questions could be based on understanding of the theoretical concepts, and some question consist in practical applications of those concepts. Once the student starts the exam there is a time limit to complete it. I think something around 90 minutes.
The following is detailed outline of the topics covered every week.
Week 1: SML
- ML Expressions and Variable Bindings
- Variables are Immutable
- Function Bindings
- Pairs and Other Tuples
- Let Expressions
- Some Other Expressions and Operators
- Lack of Mutation and Benefits Thereof
- The Pieces of a Programming Language
The homework consisted in the development of series of functions to deal with dates.
Week 2: SML
- Conceptual Ways to Build New Types
- By Name vs By Position, Syntactic Sugar and the Truth about Tuples
- Datatype Bindings
- How ML Does Not Provide Access to Data Type Values
- How ML Provides Access to Datatype Values: Case Expressions
- Type Synonyms
- Lists and Options Are Datatypes
- Polymorphic Datatypes
- Pattern Matching
- Type Inference
- Polymorphic Types and Equality Types
- Nested Patterns
- Tail Recursion and Accumulators
The homework consisted in a series of exercises related to a card game, a variation of solitaire.
Week 3: SML
- Functions as Arguments
- Polymorphic Types and Functions as Arguments
- Anonymous Functions
- Unnecessary Function Wrapping
- Maps and Filters
- Returning Functions
- Lexical Scope
- Environments and Closures
- Combining Functions
- Currying and Partial Application
- The Value Restriction
- Mutation via ML References
- Abstract Datatypes
- Closures in Other Languages
The homework consisted in a series of exercises related to the implementation of pattern matching and type inference.
Week 4: SML
- What is Type Inference
- Overview of ML Type Inference
- Mutual Recursion
- Modules for Namespace Management
- Hiding Things
- Equivalent Implementations
- Benefits of Side-Effect-Free Programming
- Standard Equivalences
There was not homework because this week was the week of the midterm exam.
Week 5: Racket
- Racket vs Scheme
- Functions, Lists
- Syntax and Parentheses
- Dynamic Typing
- Local Bindings
- Top-Level Definitions
- Delayed Evaluation with Thunks
- Lazy Evaluation
The homework consisted in the implementation of exercises related to streams and the challenge was about defining macros.
Week 6: Racket
- Datatype Programming without Datatypes
- Recursive Datatypes via Racket Lists
- Recursive Datatypes via Racket’s struc
- Implementing Programming Languages
- Interpreters and Compilers
- Implementing Closures
- Defining Macros via Functions in the Metalanguage
- ML versus Racket
- What Is Static Checking?
- Correctness, Soundness, Completeness, Undecidability
- Weak Typing
- Advantages and Disadvantages of Static Checking
The homework consisted in the implementation of an interpreter for small programming language called MUPL (Made Up Programming Language).
Week 7: Ruby
- Objects, Classes, Methods, Variables
- Visibility and Getters/Setters
- Everything is an Object
- Duck Typing
- Hashes and Ranges
- Subclassing and Inheritance
- Overriding and Dynamic Dispatch
- Method Lookup Definition
- Dynamic Dispatch versus Closures
The homework consisted in the implementation of a tetris game.
Week 8: Ruby
- OOP Versus Functional Decomposition
- Mutiple Inheritance
- Abstract Methods
- The Subtyping Relation
- Function Subtyping
- Subtyping for OOP
- Generics Versus Subtyping
- Bounded Polymorphism
The homework consisted in the implementation of an interpreter for a small language of two-dimensional geometric objects.
In my opinion this is one of the best courses I have ever taken. It was fascinating, the topics were covered in great detail. The professor Grossman explained every topic with plenty of examples and almost all the homework was really interesting and the problems were increasingly challenging. Having the opportunity to work with different programming languages of different paradigms and typing styles really enriched my understanding of how programming languages work, and how to make proper comparisons between their features. It was particularly interesting the effort of converting some implementations of solutions to some problems from functional code to object-oriented code. I think that the course prepares the students to learn and assimilate other programming languages more rapidly by having covered concepts that are typically seen in other languages just with different syntax.
From the entire course I found the sections covering Ruby a little bit more uninteresting, and particularly the homework for the tetris game in week 7 was too simple and I found little could be learn from solving the exercise, but the rest of the material and homework were incredibly well thought and prepared.
The entire experience was really enriching and I feel that it has made me a better developer and has broadened my understand of programming languages and has rekindled my enthusiasm to learn even more about programming and other programming languages. It is definitely a course that I would highly recommend to any other developers.