Document Code with Meaningful Comments (Activity)
Revision as of 18:10, 7 September 2018 by Clif.kussmaul
|Title||Document Code with Meaningful Comments|
|Overview||In this activity, students will define what "meaningful comments" mean and create a rubric for it. Then, they will create meaningful comments for a given source file with undocumented code.|
|Prerequisite Knowledge||The instructor can tailor this activity to match the current content being taught in a CS 2 course. Therefore it could be appropriate at any time during the CS 2 course.|
|Learning Objectives||Students should define “meaningful comments”. They will create a rubric for this. Each team will make use of this rubric when commenting/documenting the second source file.|
CS 1 background should suffice.
Some possible reading the instructors only (students should discover the idea of "meaningful comments"!):
- The entire class will be given a brief overview of a project. This can be chosen from the existing HFOSS projects that contain source files in the programming language used in the course.
- Then the class will be split in teams of 2-3 students, and each team will be given one file of undocumented code that has an easy complexity level. Several teams will have the same assigned code!
- Teams will then be asked to write comments for the given code.
- Then, in class, students will present their work and define "meaningful comments". While presenting, based on students' reflections, the instructor will create a rubric to assess when a code has meaningful comments and when it does not.
- Then, each team will be assigned a second file with undocumented code and they will be asked to write "meaningful comments". The students will meet again in one week and will have to present their work.
- All the students will have access to the entire project in case they want to look at the big picture while commenting the code. Depending on the complexity level, this may be a must have.
- During the presentation, the other teams will assess each team's work using the rubric created in the first phase.
- If time is available, it may be useful to compare the "meaningful comments" of students with the original comments existing in the code (but which was not made available to students).
- A rubric that can be used to assess "meaningful comments"
- Code with "meaningful comments" will be presented to the entire class.
|Knowledge Area/Knowledge Unit||Coding & Style|
|Level of Difficulty||Medium/Hard|
|Estimated Time to Completion||A total of 120 minutes is suggested. The first part can be done in class, while the second part can be given as a week-long project and then in another class period each team will have to present their code. All students will rate (based solely on the comments) the readability of the code being presented by each team.|
|Materials/Environment|| Each team will be given three materials:
|Author||Razvan A. Mezei|
|License||Licensed CC BY-SA|
Suggestions for the Open Source Project:
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License