COMP 151H - Spring 2008

Spring 2008, COMP 151H Object-Oriented Programming (Honors Study Track) [3-1-2:4]
Lecture 1, MWF 10:00-10:50, Rm 3412
Prof. Dekai WU, Rm 3539, 2358-6989,

Tutorial 1 TA: Yihai SHEN, Tu 18:00-18:50, Rm 3598,
Lab 1 TA: Yihai SHEN, Th 17:00-18:50, Rm 4214,

You are welcome to knock on the door of the instructor any time. The TAs' office hours are posted at


Welcome to COMP151H! Labs will begin Thurs 14 Feb, in Week 2. Tutorials will begin after that, on Tues 19 Feb.

Always check the Discussion Forum for up-to-the-minute announcements.

Discussion forum is at Always read before asking/posting/emailing your question. This forum is based on modern, powerful software, instead of using the old clunky ITSC newsgroup.
Course home page is at
Lab info is at


Welcome to the honors track COMP 151H, which takes over where COMP 104H left off. This course is designed to give you the solid software engineering experience necessary to build, extend, and maintain a realistically sized non-toy program, using both traditional and up-to-date techniques that you will need on the job. Most students find that C++ and other modern languages offer a huge, confusing variety of different and often-contradictory complexities. In this sequence you will untangle the confusion by gaining an enhanced holistic theoretical perspective, comparing and contrasting the most important paradigms of programming languages.

Understand by doing. The only way to learn languages is through serious practice. The only way to appreciate software engineering is to engineer some serious software. And by far the best way to understand programming languages is to implement one.

So, through an integrated series of programming assignments, you will use C++ to gradually implement your own complete interpreter for a real programming language that is a small but fully operational version of Scheme (or Lisp).

You will learn the most important procedural, static and dynamic object-oriented, and generic programming paradigms of C++ programming, through hands-on practice with building the basic pieces of your Scheme interpreter. The Scheme programming project will help deepen the C++ concepts you have learned, by giving you a better understanding of the functional and generic programming roots and foundations that underlie the design and effective use of STL in the C++ Standard Library. If we progress sufficiently rapidly, then we will also learn about the syntactic description and analysis of programming languages, and their runtime environments. Throughout the entire series, you will focus on developing adequate software engineering habits, so that you can continue to build, extend, and maintain the code you have built so far.

Academic Calendar Description

151. Object-oriented programming concepts and techniques. Software reuse. Classes, objects, and methods. Abstract data types. Object creation and initialization. Message passing. Class hierarchies and inheritance. Polymorphism. Templates and algorithm abstraction. Prerequisite: COMP 103 or COMP 104


Reference Books


To receive a passing grade, you are required to sign an honor statement acknowledging that you understand and will uphold all policies on plagiarism and collaboration.


All materials submitted for grading must be your own work. You are advised against being involved in any form of copying (either copying other people's work or allowing others to copy yours). If you are found to be involved in an incident of plagiarism, you will receive a failing grade for the course and the incident will be reported for appropriate disciplinary actions.

University policy requires that students who cheat more than once be expelled. Please review the cheating topic from your UST Student Orientation.

Warning: sophisticated plagiarism detection systems are in operation!


You are encouraged to collaborate in study groups. However, you must write up solutions on your own. You must also acknowledge your collaborators in the write-up for each problem, whether or not they are classmates. Other cases will be dealt with as plagiarism.


The course will be graded on a curve, but no matter what the curve is, I guarantee you the following.

If you achieve 85% you will receive at least a A grade.
75% B
65% C
55% D

Your grade will be determined by a combination of factors:

Midterm exam ~20%
Final exam ~25%
Participation ~5%
Homework ~40%
Labs ~10%


No reading material is allowed during the examinations. No make-ups will be given unless prior approval is granted by the instructor, or you are in unfavorable medical condition with physician's documentation on the day of the examination. In addition, being absent at the final examination results in automatic failure of the course according to university regulations, unless prior approval is obtained from the department head.

There will be one midterm worth approximately 20%, and one final exam worth approximately 25%.


Software engineering is about communication between people. Good participation in class and/or the online forum will count for approximately 5%.


All programming assignments must be submitted by 23:00 on the due date. C++ programming assignments must be compiled using g++ on Unix and will be collected electronically using the automated CASS assignment collection system. Late assignments cannot be accepted. Sorry, in the interest of fairness, exceptions cannot be made.

Programming assignments will account for a total of approximately 40%.


All information for laboratory/tutorial assignments is at

Laboratory/tutorial assignments will be due Wednesday of the week after they are announced at 23:00. Laboratory/tutorial assignments must be in C++ on Unix and will be collected electronically using the automated CASS assignment collection system. Late assignments cannot be accepted. Sorry, in the interest of fairness, exceptions cannot be made.

You will also have the option to turn in your laboratory/tutorial assignments in lab by demonstrating to the TA. This will also give you an opportunity to get an early indication of whether your assignment is correct. If not, you may still decide to fix it, and then wait until the Wednesday 23:00 CASS collection to turn in your assignment.

There will be up to 10 laboratory/tutorial assignments, which in total will count for approximately 10%.


Date Wk Event Paradigm Topic Notes Reading Assignments
2008.02.01 1 Lecture Administrivia (honor statement, HKUST classroom conduct) Business Week, The Perils of JavaSchools
2008.02.04 1 Lecture SwEngr Introduction: C++ and software engineering (doxygen notes: Marine's, Adam's) V1.Ch1
2008.02.06 1 Lecture Procedural Introduction (cont) (self-review: References, Const) V1.Ch3,
2008.02.08 1 Holiday Lunar New Year
2008.02.11 2 Lecture SwEngr Introduction: Data abstraction V1.Ch2
2008.02.13 2 Lecture SwEngr Introduction: Data abstraction (cont) (YourPets2a.cpp, YourPets2b.cpp) V1.Ch4
2008.02.15 2 Lecture Procedural Declaration and definition (reverse_print.cpp, use_reverse_print.cpp, reverse_print.hpp) V1.Ch5
2008.02.18 3 Lecture StaticOO Overloading and constructors (Makeup lecture Rm 2407 19:00-20:00) V1.Ch6
2008.02.20 3 Lecture StaticOO Destructors (Makeup lecture Rm 2407 20:00-21:00) V1.Ch6
2008.02.22 3 Lecture StaticOO Order of construction/destruction, Post Office example, argc & argv V1.Ch6
2008.02.25 3 Lecture StaticOO Inheritance: Introduction V1.Ch14
2008.02.27 4 Lecture StaticOO Inheritance: Substitution principle V1.Ch14
2008.02.29 4 Lecture Functional Project (Assignment 1): Encapsulation, s-expressions, cons lists, tagged unions, eval
2008.03.03 5 Lecture StaticOO Inheritance: Access control: public, protected, private V1.Ch14
2008.03.05 5 Lecture DynamicOO Inheritance: Virtual functions V1.Ch15
2008.03.10 6 Lecture DynamicOO Inheritance: Overriding vs overloading V1.Ch15
2008.03.12 6 Lecture DynamicOO Inheritance: Abstract base classes, ex1, ex2, ex3, ex4 V1.Ch15
2008.03.14 6 Lecture Functional Project (Assignment 2): Polymorphic reimplementation, exposing car/cdr/cons/nullp
2008.03.17 7 Lecture StaticOO The "this" pointer V1.Ch4
2008.03.19 7 Lecture StaticOO Inheritance: Public, private, protected inheritance V1.Ch14
2008.03.19 7 A1 due
2008.03.21 7 Holiday Mid-Semester Break
2008.03.24 7 Holiday Mid-Semester Break
2008.03.26 7 Holiday Mid-Semester Break
2008.03.28 7 Exam Midterm (Rm 2304 19:00-21:00; sample exam for your practice)
2008.03.31 8 Lecture SwEngr Exceptions V2.Ch1
2008.04.02 8 Lecture Generic Introduction to generic programming V1.Ch16
2008.04.04 8 Holiday Ching Ming Festival
2008.04.07 9 Lecture Generic Function and class templates V1.Ch16
2008.04.09 9 Lecture Generic Overloading operators V1.Ch12
2008.04.11 9 Lecture Functional Project (Assignment 3): Exceptions, boolean operators, exposing eval & print (Makeup lecture Rm 4619 19:00-22:00)
2008.04.13 9 A2 due
2008.04.14 10 Lecture Functional Project (Assignment 3): Symbol tables, the define operator, STL map (Makeup lecture Rm 4619 20:00-21:00)
2008.04.16 10 Lecture Generic Container classes V2.Ch7
2008.04.18 10 Lecture Generic STL: Sequences & Iterators V2.Ch6
2008.04.21 11 No lecture
2008.04.23 11 No lecture
2008.04.28 12 Lecture Generic STL: Sequences & Iterators (cont'd)
2008.04.29 12 A3 due
2008.04.30 12 Lecture Generic STL: Introduction to algorithms V2.Ch6
2008.05.02 12 Lecture Generic STL: Function pointers V2.Ch6, ref V1.Ch3
2008.05.05 13 Lecture Generic STL: Function objects or functors V2.Ch6
2008.05.06 13 A4 due
2008.05.07 13 Lecture Generic STL: More algorithms V2.Ch6
2008.05.09 13 Lecture Procedural Scope and Parameter Passing Ch5.1 - Ch5.4
2008.05.04 14 Holiday The Birthday of the Buddha
2008.05.14 14 Lecture Procedural Activation Records Ch5.5 - Ch5.7
2008.05.16 14 Lecture Functional Activation Records, cont'd
Lecture SwEngr Namespaces V1.Ch10
Lecture SwEngr Static V1.Ch2
2008.05.16 14 A5 due
2008.05.30 15 Exam Final (Rm 3008 16:30-19:30; sample final exam plus a sample midterm and another sample midterm for your practice)
Last updated: 2008.05.06