Title Image

Announcements

  • 2022-02-21
    There will be no labs next week (Feb 28 - Mar 4). Labs will resume on Week 5 beginning on Mar 7.
  • 2022-02-07
    The midterm exam will be held on April 9 (Saturday) 3pm-6pm. Please mark it on your calendar.
  • 2022-02-07
    There will be no labs in the first 2 academic weeks. Labs will start on Week 3 beginning on Feb 21.
  • 2022-01-13
    Welcome to COMP 2012! For this course, we use our own course webpage (https://course.cse.ust.hk/comp2012/) and grades can be found on Canvas. Discussions are also done via Piazza on Canvas.

Course Details

Textbooks and Reference Book


Topics Covered

  1. General review on C++ class basics
  2. C++11 lambdas
  3. Separate compilation and makefile
  4. Constructors, destructor, initialization
  5. Inheritance, polymorphism, and dynamic binding
  6. Generic programming
  7. STL: containers, iterators, algorithms
  8. Namespace
  9. Static member functions/data
  10. Hashing
  11. Binary search trees
  12. AVL tree
  13. rvalue reference and move semantics

Intended Learning Outcomes

On successful completion of this course, students are expected to be able to:

  1. Write object-oriented programs in C++ with object creation, destruction, member variables and functions, inheritance, polymorphism, and templates.
  2. Analyze simple problems and provide solutions with OOP.
  3. Understand the basic operations of data structures such as stacks, queues, lists, binary search trees, and hashes, and their implementations.
  4. Demonstrate the ability to use the learned data structures to solve problems in C++.
  5. Develop large programs using separate compilation, good OOP design, and code reuse through the use of inheritance, generic programming and the standard template library.

Prerequisites & Exclusions

Pre-requisite: COMP 2011. Exclusion: COMP 2012H.

Schedule

Lecture Schedule

Section Date and Time Zoom Venue (when we switch to face-to-face mode) Instructor
L1 WeFr 04:30PM - 05:50PM Meeting link Rm 1104, Acad Concourse MAK, Brian Kan Wing
L2 TuTh 09:00AM - 10:20AM Meeting link Rm 4619, Lift 31-32 CHAN, Ki Cecia
L3 TuTh 04:30PM - 05:50PM Meeting link Rm 1104, Acad Concourse CHAN, Ki Cecia
L4 WeFr 01:30PM - 02:50PM Meeting link Rm 2502, Lift 25-26 PAPADOPOULOS, Dimitris

Lab Schedule

Section Date and Time Zoom TA1 TA2
LA1 Fr 10:30AM - 12:20PM Meeting link MAK, Wai Ho Wallace CHENG, Tien-chun / SEN, Yigit
LA2 Tu 02:00PM - 03:50PM Meeting link ZHANG, Mingyang NARAYAN, Aadityavardhan / VUONG Tung Duong
LA3 Th 01:30PM - 03:20PM Meeting link LI, Mengxuan CAI, Zhuo
LA4 We 03:00PM - 04:50PM Meeting link TONG, Wai ZHOU, Yuxuan
LA5 Mo 01:30PM - 03:20PM Meeting link CHAU, Chun Yin YE, Chengfeng

Grading Scheme

Item Percentage
Programming assignment - PA1 10%
Programming assignment - PA2 10%
Programming assignment - PA3 10%
Programming assignment - PA4 10%
Laboratory exercises 14%
Final examination 46%

Please check your own marks from the COMP2012 Canvas page.

Note:

  • To pass this course, it is not sufficient to have your total score greater than the pass mark X.
  • You are also required to obtain a separate pass mark Y in your exams. That is, to pass, you are required to have:

    (Total score >= X) AND ((Final exam score * 0.46) >= Y)

    It is assumed that all scores in the above formula are already scaled to 100 maximum. X and Y will be determined at the end of the semester. However, we promise you that X will not be greater than 50, and Y will not be greater than 13.8 (30% of all the exam components).

Assessment Rubrics

Course Learning Outcome

Exemplary

Competent

Needs Work

Unsatisfactory

1. Write object-oriented programs in C++ with object creation, destruction, member variables and functions, inheritance, polymorphism, and templates.

Demonstrate a comprehensive grasp of object-oriented concepts and fully demonstrates how to write object-oriented programs in C++.

Demonstrate a thorough grasp of object-oriented concepts and mostly demonstrates how to write object-oriented programs in C++.

Demonstrate a basic grasp of object-oriented concepts and barely able to demonstrate how to write object-oriented programs in C++.

Demonstrate a lack of grasp of object-oriented concepts and fail to demonstrate how to write object-oriented programs in C++.

2. Analyze simple problems and provide solutions with OOP.

Demonstrate an exemplary ability to analyze problems and solve them using OOP.

Demonstrate a proficient ability to analyze problems and solve them using OOP.

Demonstrate a developing ability to analyze problems and solve them using OOP.

Demonstrate deficiencies in their ability to analyze problems and solve them using OOP.

3. Understand the basic operations of data structures such as stacks, queues, lists, binary search trees, and hashes, and their implementations.

Demonstrate excellent understanding of the basic operations of the learned data structures and ability to implement them.

Demonstrate sufficient understanding of the basic operations of the learned data structures and ability to implement them.

Demonstrate limited understanding of the basic operations of the learned data structures and limited ability to implement them.

Demonstrate a lack of understanding of the basic operations of the learned data structures and inability to implement them.

4. Demonstrate the ability to use the learned data structures to solve problems in C++

Demonstrate an exemplary ability to use the learned data structures to solve problems in C++.

Demonstrate a proficient ability to use the learned data structures to solve problems in C++.

Demonstrate a developing ability to use the learned data structures to solve problems in C++.

Demonstrate deficiencies in the ability to use the learned data structures to solve problems in C++.

5. Develop large programs using separate compilation, good OOP design, and code reuse through the use of inheritance, generic programming and the standard template library.

Demonstrate complete comprehension of OOP concepts and techniques for the development of large programs.

Demonstrate basic comprehension of OOP concepts and techniques for the development of large programs.

Demonstrate minimal comprehension of OOP concepts and techniques for the development of large programs.

Demonstrate no comprehension of OOP concepts and techniques for the development of large programs.

People

Instructor

Brian Mak MAK, Brian Kan Wing
Rm 3513
mak@cse.ust.hk
http://www.cse.ust.hk/~mak
Find me by PathAdvisor: Click Here
CHAN, Ki Cecia CHAN, Ki Cecia
Rm 3525
kccecia@cse.ust.hk
http://www.cse.ust.hk/~kccecia
Find me by PathAdvisor: Click Here
PAPADOPOULOS, Dimitris PAPADOPOULOS, Dimitris
Rm 2537
dipapado@cse.ust.hk
http://www.cse.ust.hk/~dipapado
Find me by PathAdvisor: Click Here

Teaching Assistants

Wallace   MAK, Wai Ho Wallace
Rm 2532
wallacem@cse.ust.hk
Find me by PathAdvisor: Click Here
CHAU, Chun Yin   CHAU, Chun Yin
Rm (Not available)
cychauab@cse.ust.hk
Find me by PathAdvisor: Click Here
CAI Zhuo   CAI Zhuo
Rm (Not available)
zcaiam@cse.ust.hk
Find me by PathAdvisor: Click Here
TONG, Wai   TONG, Wai
Rm CYT3007
wtong@cse.ust.hk
Find me by PathAdvisor: Click Here
Zhang, Mingyang   Zhang, Mingyang
Rm 4201
mzhangbj@cse.ust.hk
Find me by PathAdvisor: Click Here
YE, Chengfeng   YE, Chengfeng
Rm 3661
cyeaa@cse.ust.hk
Find me by PathAdvisor: Click Here
LI, Mengxuan   LI, Mengxuan
Rm CYT3007
mlibs@cse.ust.hk
Find me by PathAdvisor: Click Here
ZHOU, Yuxuan   ZHOU, Yuxuan
Rm 4030
yzhoudo@cse.ust.hk
Find me by PathAdvisor: Click Here

Lectures



The schedule listed below is tentative. Instructors may have some adjustments subject to the progress.

Week# Topics / Note Handout Reading Code / Additional Materials
1-2 Intro, review, const-ness, lambda 2022/02/05
[previous: 2022/01/31]
Deitel: Chap 8 Programs
Reviews on pointers and references
2-4 Constructors & Destructor 2022/02/14 Deitel: Chap 9 Programs
5-7 Inheritance and Polymorphism 2022/02/14 Deitel: Chap 11, 12 Programs
7-9 Generic Programming 2022/02/14 Deitel: Chap 18, 19, 10 Programs
10-11 Hashing 2022/04/06 Weiss: Chap 5
11-12 Binary Search Tree 2022/04/09 Weiss: Chap 4, Chap 3.6 Programs
12-13 rvalue Reference and Move Semantics 2022/04/28 Deitel: (Web) Chap 24 Programs
Self-study Notes
2 Makefile (Self-study) 2022/02/02 Programs
6 Namespace (Self-study) 2022/02/02 Deitel: Chap 23.4 Programs
9-10 Standard Template Library (STL) (Self-study) 2022/02/14 Weiss: Chap 9.14 Programs
12 Static Class Data/Methods (Self-study) 2022/02/14 Weiss: Chap 9.14 Programs
11-12 AVL (Self-study) 2022/04/09 Weiss: Chap 4, Chap 4.4 Programs

Lecture Attendance via Zoom

For the first few weeks lectures will only be held via Zoom meetings. Later in the semester, we may switch to face-to-face teaching in which case you will be notified. The links for the meetings are available at the Canvas page of the course, under the tab Zoom meetings. Before you join a meeting for the first time visit this page and sign in to Zoom using your HKUST e-mail, as our lecture meetings will require HKUST user authentication. When attending a lecture meeting,

  1. please rename yourself to:

    LASTNAME Firstname studentusername E.g., CHAN Wing Ho cwingho

  2. During a Zoom meeting, please remain muted to avoid interfering the class with sounds from your background.
  3. You are highly recommended to ask question by voice. To do that, please push the Raise Hand button, and the instructor will then unmute you.
  4. You may also use the Chat function to post questions or comments. Note that if there are too many chats, the instructor may not be able to answer them timely.
  5. We strongly recommend that you turn on your camera with virtual background. It helps create a more interactive online classroom experience.
If your have not used Zoom before, we suggest that you try it out and get familiar with it before the first lecture. You can find a good general set of guidelines here.



Honor Code

Honesty and integrity are central to academic work. You must observe and uphold the highest standards of academic integrity and honesty in all the work (lab exercises, programming assignments, quiz, exams, etc.) you do in this course. We deal with cheating cases seriously and the maximum penalty is a FAIL in the course plus additional disciplinary actions from the CSE Department as well as from the University. Both the copier(s) and the copiee will be punished, and the penalty will be more than just a zero mark in your assignments/exams.

Here are links to the University's Honor code, and the University's Penalties for Cheating.

If you are not sure what is considered plagiarism,
  • Do NOT copy program codes from another student/person.
  • Do NOT look at the actual program codes of another student.
  • Do NOT share actual program codes with other students/people (by paper, emails, blogs, FB, Google Doc, etc.).
  • Do NOT give your program codes to other students who ask for it, and do not ask for a copy of their code either.
  • Do NOT post your program codes anywhere online.
  • Do NOT leave your finished/unfinished program codes unattended.
  • While we encourage discussion among students, you have to write codes on your own.
  • During discussion, you should NOT go to the details such that everyone will end up in the same code.
The list is by no means exhaustive, and you will need to use your own discretion.

Labs

The lab exercises are designed to help you learn a programming language with on-the-spot advices of a teaching assistant. All the TAs assigned to the course are supposed to be very experienced in C++ programming. It is more a service to you than an exercise for the marks. The lab mark is only set to encourage you to make good use of the lab time.


We will use VS Code as the development platform for C++ programming. Please read the following tutorial which will help you get started:


Labs this semester will be conducted online via Zoom meetings (until we switch to mixed-mode teaching later in the semester, if it will happen).

But similar to the past, a successful completion of the lab is subject to the following conditions:

  1. Attend the lab
  2. Finish the requirement / program and submit it to ZINC (automatic grading system) by the end of your lab session. Do not submit your program assignments to ZINC using the accounts of other students.
  3. Answer a question related to the lab to show that you really work out the solution yourself.

Each lab is worth 3 points, 1 point for each of the items above.


Note to all students:

  • When attending the lab meeting, make sure to set up your screen username to:
    LASTNAME Firstname studentusername E.g., CHAN Wing Ho cwingho
  • We will put each of you, in a randomized order, to a breakout room to ask you a question related to the lab. You are supposed to come at the beginning of each lab session, and latecomers will be served at the very end.
  • We will have a TA in the main room to help you or answer any C++ questions, when it is not your turn.

[Public holiday exception]

If a day is a public holiday, students are not required to attend the labs held on that day. There will be no points for these labs for only those students who originally are supposed to attend these labs; other students are not affected. As different students may be affected by different public holidays, the final total lab points will be normalized according to the number of labs a student has to take. However, although a student may not need to attend a lab on a day that happens to be a public holiday, we strongly encourage the student to still go over the materials of that lab and try to finish it. Labs help students review what they are taught in lectures and get ready for the next lab.

This policy will also apply to situations when classes/labs are cancelled due to, e.g., adverse weather conditions, etc.


Important notes:

  • You must attend the lab meeting for your assigned lab session. If you need to go to a different lab meeting, you MUST seek prior approval from your course instructor.

  • Although you are not required to finish the lab exercises before attending the lab meeting, you are strongly suggested to read through the requirements beforehand and try to finish part of the tasks. If you came across any problems, please (a) ask your questions on Piazza; (b) check the Piazza chats regularly; chances are that your questions have been asked already; (c) approach your instructor/TAs before your lab session by emails.

  • No late lab assignment will be accepted.


-->
Dates Tentative Topic Solution
Lab 1: Feb 21 - 25 Makefile and Separate Compilation

Please see the lab policy manual. Also note that we will use this public Google sheet to determine the demo order. Your lab TAs will explain both in the first lab.
solution (will be accessible in the following week)
Lab 2: March 7-11 Class Construction and Destruction solution
Lab 3: March 14-18 Namespace solution
Lab 4: March 21-25 Inheritance: Effect of Substitution and Slicing solution
Lab 5: March 28 - April 1 Polymorphism: Virtual Functions solution
Lab 6: April 11 - April 22 Template & Operator Overloading solution
Lab 7: April 25 - April 29 Friends, Static Method/Data solution
Lab 8: May.2 - May.6 Binary Search Tree Solution

Assignments

Assignment TA-in-charge Solution
Assignment 1: Polynomial Wallace Mak (wallacem@cse.ust.hk) Grades and Marking scheme
Assignment 2: Digital Signatures Zhuo CAI (zcaiam@cse.ust.hk) Grades and Marking scheme
Assignment 3: Smart Pointers Chun Yin CHAU (cychauab@cse.ust.hk) Grades and Marking scheme
Assignment 4: Magic Shop of a Computer Wizard Wallace Mak (wallacem@cse.ust.hk)

Exams


Past Exam Papers

FAQs

How hard should I work?


Some people say that a 3-unit course takes 8 hours/week. It all depends. You should cultivate an independent learning habit.

Here is a guideline:
  • pre-study (15 - 30 minutes): what topic/materials will the coming lecture be covering?
  • attend class: The A+ students tell you that they pay FULL attention in class and try to understand everything in the class so that it is easy to review the class materials.
    • our notes provide a guideline; also take your own notes
    • ask questions whenever you don't understand
  • post-study (3 hours): re-reading the notes, book reading


How do I learn a new programming language?



Learning a programming language is similar to learning a human language (like Chinese, English, French, etc.) but only easier. However, the basic technique is similar to the 3Rs:
  • read more: we are not going to follow the recommended textbook vigorously, and we can't give all the details in our lectures. Read the book!
  • write more: there are only 3 programming assignments in this class. That is NOT enough! Think of problems around you and try to solve them by writing a computer program.

 

How can I write a program effectively?



You should spend a lot of time in THINKING (stay away from the computer) before you start WRITING. No matter how beautiful your codes are, if the method you use is wrong, they are still wrong codes.

Here is a guideline:
  • planning (30 - 40%) : algorithm design, code design, documentation
  • coding (60 - 70%) : writing code, debugging, testing

Where may I get help on programming problems?



God help those who help themselves! But if you can't find your God, try the following, in that order:
  • Post your question to the COMP2012 discussion forum on Canvas. Your question — even you think it may be a dumb question — usually is also the question of your fellow classmates. Your TAs will read messages in the newsgroup too and answer your question. Furthermore, other classmates will read your question and may also answer it.
  • Email your question to your TAs. (We do most business using emails here in the university.) Please do not expect an answer right away.
  • Email your question to the instructor.
  • Don't expect the instructor and your TAs to be your debugger! Except for obvious bugs, we won't debug for you.
  • Find it on the Web.

Where may I get more information about the computing facilities in CSE department?


You can't afford to miss the following URL from our cssystem:
http://cssystem.cse.ust.hk/home.php?docbase=UGuides&req_url=UGuides/index.html#ug