Repo exploration for overloading ops in C++ Activity

From Foss2Serve
(Difference between revisions)
Jump to: navigation, search
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
__NOTOC__
  
{| border="1"
+
{{Learning Activity Overview
|-
+
|title=
|'''Title''' || Exploring a C++ GitHub repository to learn about operator overloading (page in progress)
+
Exploring a C++ GitHub repository to learn about operator overloading
|-
+
|overview=
|'''Overview''' || Student will search a repo to find a specific class that implements infinite precision arithmetic and answer questions about it
+
Student will search a repo to find a specific class that implements infinite precision arithmetic and answer questions about it
|-
+
|prerequisites=
|'''Prerequisite Knowledge''' || Basic CS1 background, including basic C++ class programming concepts
+
Basic CS1 background, including basic C++ class programming concepts
|-
+
|objectives=
|'''Learning Objectives''' || The student should be able to search GitHub repositories in general; to read code and understand enough to know what overloaded operators do; to understand what inline functions are and when it is appropriate to use them; and to understand the advantages of using overloaded C++ operators and how to create them.
+
* Search GitHub repositories in general.
|}
+
* Read code and describe in detail what the overloaded operators do.
 +
* Identify the inline functions and explain when it is appropriate to use them.
 +
* Explain the benefits of using overloaded C++ operators and how one can create them.
 +
|process skills=
 +
}}
 +
 
 +
=== Background ===
  
=== Background: ===
 
 
The problem that this activity attempts to solve is how to introduce basic FOSS concepts to CS2 students in the context of learning about CS2-specific topics.
 
The problem that this activity attempts to solve is how to introduce basic FOSS concepts to CS2 students in the context of learning about CS2-specific topics.
  
Before this activity is assigned, the students should be introduced to the concepts of online repositories, free and open source software, and to a very limited extent, the use of GitHub. It is not really necessary to know how to use the version control features of GitHub for this activity because the students are not cloning code or uploading it. They can do this activity entirely by browsing the code on-line.  
+
Before this activity is assigned, the students should be introduced to the concepts of online repositories, free and open source software, and to a very limited extent, the use of GitHub. It is not really necessary to know how to use the version control features of GitHub for this activity because the students are not cloning code or uploading it. They need to know how to search GitHub and open files stored there.  They can do this activity entirely by browsing the code on-line.  
  
 
The activity asks the students to search through the GitHub repository for the class that implements infinite precision decimal numbers. It then asks them to look at the interface file for this class.
 
The activity asks the students to search through the GitHub repository for the class that implements infinite precision decimal numbers. It then asks them to look at the interface file for this class.
Line 21: Line 27:
 
In terms of their coding knowledge, they should know how to read C++ class interfaces and implementation files, know how to read C++ function definitions, and be able to write C++ programs that use classes. One of the questions asks them to examine a function that is recursive, without stating that it is recursive, and gets them to discover this. Students who have been introduced to recursive C++ functions will have a different response from those who have not.  
 
In terms of their coding knowledge, they should know how to read C++ class interfaces and implementation files, know how to read C++ function definitions, and be able to write C++ programs that use classes. One of the questions asks them to examine a function that is recursive, without stating that it is recursive, and gets them to discover this. Students who have been introduced to recursive C++ functions will have a different response from those who have not.  
  
Students will be given specific reading materials before starting this project, including:
+
Although no prerequisite knowledge abut open source or git is needed to do this activity, it serves as a good means for students to inform themselves about these. As such, students will be given specific reading materials before starting this project, including:
 +
* https://www.gnu.org/philosophy/free-sw.html
 +
* https://opensource.org/faq
 +
* https://guides.github.com/activities/hello-world/
  
populate this lists here!!
+
=== Directions ===
  
 
=== Directions: ===
 
 
Students should be told that, as they do all of these exercises, they should write the answers to all questions in the form provided. The instructor should create a template form to simplify grading and assessment of student responses.
 
Students should be told that, as they do all of these exercises, they should write the answers to all questions in the form provided. The instructor should create a template form to simplify grading and assessment of student responses.
  
# ITK (Insight Segmentation and Registration Toolkit) is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. You can learn more about it from its website, [https://itk.org  https://itk.org ]. Find the page on this website that has a link to the Software Guide. Write down how many pages are in the latest Software Guide.
+
# ITK (Insight Segmentation and Registration Toolkit) is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. You can learn more about it from its website, [https://itk.org  https://itk.org ]. Find the page on this website that has a link to the Software Guide. Write down how many pages are in the latest Software Guide.<br /><br />
# The source code for ITK is available on GitHub [https://github.com/ https://github.com/]. Go to the GitHub website and find the ITK repository. Write down how you found the download page for the repository.
+
# The source code for ITK is available on GitHub [https://github.com/ https://github.com/]. Go to the GitHub website and find the ITK repository. Write down how you found the download page for the repository.<br /><br />
 
# The developers of ITK decided that it was advantageous to create classes that implement infinite precision numbers. They distinguished between infinite precision decimal numbers and infinite precision integers. Find the interface file (header file) for the class that implements infinite precision  numbers with decimal arithmetic and open the file. Provide answers to the following questions:
 
# The developers of ITK decided that it was advantageous to create classes that implement infinite precision numbers. They distinguished between infinite precision decimal numbers and infinite precision integers. Find the interface file (header file) for the class that implements infinite precision  numbers with decimal arithmetic and open the file. Provide answers to the following questions:
 
#* What is the name of the header file?
 
#* What is the name of the header file?
 
#* What is the name of the class?
 
#* What is the name of the class?
 
#* Who authored this code?
 
#* Who authored this code?
#* When was it last modified?
+
#* When was it last modified?<br /><br />
 
# There are two functions in this file whose name is  <code>operator>></code>.  
 
# There are two functions in this file whose name is  <code>operator>></code>.  
 
#*  Are they public or private?
 
#*  Are they public or private?
Line 41: Line 48:
 
#*  When two functions have the same name what is this called?
 
#*  When two functions have the same name what is this called?
 
#*  What does the first of these functions do? Read about this in the file's comments and in your textbook and explain in your own words what this function does.
 
#*  What does the first of these functions do? Read about this in the file's comments and in your textbook and explain in your own words what this function does.
#*  What is this word "inline" -- why is it used?
+
#*  What is the purpose of the word <code>inline</code> -- why is it used?<br /><br />
# Notice that there are many functions defined in this file that also contain the word <code>operator</code>, such as <code>operator+=</code> and <code>operator-</code>.  
+
# Notice that there are many functions defined in this file whose names contain the word <code>operator</code>, such as <code>operator+=</code> and <code>operator-</code>.  
 
#* Why are they here? In other words, what use are these? You might have to read about this in your C++ textbook.
 
#* Why are they here? In other words, what use are these? You might have to read about this in your C++ textbook.
#* Why have the developers created all of these operator functions?  
+
#* Why, do you think, the developers created all of these operator functions? <br /><br />
 +
# Find the implementation file for this interface and open it. What is its name?<br /><br />
 +
# Find the implementation of <code>operator< </code>. Read it carefully.
 +
#* Does it depend on any other user-defined functions? Which ones?<br /><br />
 +
# Find the implementation of <code>operator+ </code>. This depends on many functions.
 +
#* List the operator functions that it depends on.
 +
#* What is unusual about this function? (Note for instructor: It is recursive, but the student may not realize this unless they study the code carefully.)
  
=== Deliverables: ===
 
The student will hand in a completed form containing the answers to the given questions.
 
  
=== Assessment: ===
+
=== Deliverables ===
How will the activity be graded?
+
+
How will learning will be measured?
+
  
Include sample assessment questions/rubrics.
+
The student will hand in a completed form containing the answers to the given questions. This  [[Media:Template_for_repo_activity.txt | template file]] is a template with the questions and a rubric.
  
{| border="1" class="wikitable"
+
=== Assessment ===
! Criteria
+
! Level 1 (fail)
+
! Level 2 (pass)
+
! Level 3 (good)
+
! Level 4 (exceptional)
+
|-
+
| '''Criterion 1...'''
+
|
+
|
+
|
+
|
+
  
|-
+
The assignment can be graded in the traditional way, by a numeric score out of 100 possible points. The questions in the above template have suggested weights, but clearly the instructor is free to change the weights.
| '''Criterion 2...'''
+
|
+
Grades on out-of-class assignments do not necessarily reflect how much a student has learned, for several reasons. To determine how well a student has learned about the actual C++ feature of overloaded operators and their use, as well as the GitHub related skills that should have been acquired, the instructor is better off by using in-class pop quiz given after the assignment is due.
|
+
Therefore, no further assessment guidance is suggested here.
|
+
|
+
  
|}
 
  
=== Comments: ===
+
=== Comments ===
What should the instructor know before using this activity?
+
  
What are some likely difficulties that an instructor may encounter using this activity?
+
This activity is an active-learning approach to teaching about operator overloading and in-line functions. Students might express frustration because they are being asked to learn something
 +
before they have been taught about it by the instructor. They need a bit of patience.
  
 
=== Additional Information: ===
 
=== Additional Information: ===
{| border="1"
 
|-
 
|'''ACM Knowledge Area/Knowledge Unit''' || What ACM Computing Curricula 2013 knowledge area and units does this activity cover? [[ACM_Body_of_Knowledge]]
 
|-
 
|'''ACM Topic''' || What specific topics are addressed? The Computing Curriucula 2013 provides a list of topics - https://www.acm.org/education/CS2013-final-report.pdf
 
|-
 
|'''Level of Difficulty''' || Is this activity easy, medium or challenging?
 
|-
 
|'''Estimated Time to Completion''' ||  How long should it take for the student to complete the activity?
 
|-
 
|'''Materials/Environment''' || What does the student need?  Internet access, IRC client, Git Hub account, LINUX machine, etc.?
 
|-
 
|'''Author(s)''' || Who wrote this activity?
 
|-
 
|'''Source''' || Is there another activity on which this activity is based?  If so, please provide a link to the original resource.
 
|-
 
|'''License''' || Under which license is this material made available? (http://creativecommons.org/licenses/)
 
|}
 
  
=== Suggestions for Open Source Community: ===
+
{{Learning Activity Info
Suggestions for an open source community member who is working in conjunction with the instructor.
+
|acm unit=
 +
Programming Languages/Object-Oriented Programming, Software Development Fundamentals/Fundamental Programming Concepts
 +
|acm topic=
 +
Overloaded operators, in-line functions
 +
|difficulty=
 +
Easy to moderate
 +
|time=
 +
2-3 hours
 +
|environment=
 +
Any platform with a modern Internet browser.
 +
|author=
 +
Stewart Weiss
 +
|source=
 +
N/A
 +
|license=
 +
{{License CC BY SA}}
 +
}}
 +
 
  
--------------------
+
=== Suggestions for Open Source Community ===
This work is licensed under a
+
[http://creativecommons.org/licenses/by-sa/4.0/ Creative Commons Attribution-ShareAlike 4.0 International License]
+
  
[[File:CC_license.png]]
+
This can be adapted to many other language features and to other languages as well.
  
[[Category: Learning_Activity]]
+
[[Category:Learning Activity]]
[[Category: CS2]]
+
[[Category:CS2]]
 +
[[Category:Good Draft]]

Latest revision as of 11:50, 8 September 2018


Title

Exploring a C++ GitHub repository to learn about operator overloading

Overview

Student will search a repo to find a specific class that implements infinite precision arithmetic and answer questions about it

Prerequisites

Basic CS1 background, including basic C++ class programming concepts

Learning
Objectives
After successfully completing this activity, the learner should be able to:
  • Search GitHub repositories in general.
  • Read code and describe in detail what the overloaded operators do.
  • Identify the inline functions and explain when it is appropriate to use them.
  • Explain the benefits of using overloaded C++ operators and how one can create them.
Process Skills
Practiced


Background

The problem that this activity attempts to solve is how to introduce basic FOSS concepts to CS2 students in the context of learning about CS2-specific topics.

Before this activity is assigned, the students should be introduced to the concepts of online repositories, free and open source software, and to a very limited extent, the use of GitHub. It is not really necessary to know how to use the version control features of GitHub for this activity because the students are not cloning code or uploading it. They need to know how to search GitHub and open files stored there. They can do this activity entirely by browsing the code on-line.

The activity asks the students to search through the GitHub repository for the class that implements infinite precision decimal numbers. It then asks them to look at the interface file for this class. The particular objectives are to get them to learn something about exploring GitHub, about reading code and comments, about overloaded operators and inline versus non-inline functions.

In terms of their coding knowledge, they should know how to read C++ class interfaces and implementation files, know how to read C++ function definitions, and be able to write C++ programs that use classes. One of the questions asks them to examine a function that is recursive, without stating that it is recursive, and gets them to discover this. Students who have been introduced to recursive C++ functions will have a different response from those who have not.

Although no prerequisite knowledge abut open source or git is needed to do this activity, it serves as a good means for students to inform themselves about these. As such, students will be given specific reading materials before starting this project, including:

Directions

Students should be told that, as they do all of these exercises, they should write the answers to all questions in the form provided. The instructor should create a template form to simplify grading and assessment of student responses.

  1. ITK (Insight Segmentation and Registration Toolkit) is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. You can learn more about it from its website, https://itk.org . Find the page on this website that has a link to the Software Guide. Write down how many pages are in the latest Software Guide.

  2. The source code for ITK is available on GitHub https://github.com/. Go to the GitHub website and find the ITK repository. Write down how you found the download page for the repository.

  3. The developers of ITK decided that it was advantageous to create classes that implement infinite precision numbers. They distinguished between infinite precision decimal numbers and infinite precision integers. Find the interface file (header file) for the class that implements infinite precision numbers with decimal arithmetic and open the file. Provide answers to the following questions:
    • What is the name of the header file?
    • What is the name of the class?
    • Who authored this code?
    • When was it last modified?

  4. There are two functions in this file whose name is operator>>.
    • Are they public or private?
    • How do they differ?
    • When two functions have the same name what is this called?
    • What does the first of these functions do? Read about this in the file's comments and in your textbook and explain in your own words what this function does.
    • What is the purpose of the word inline -- why is it used?

  5. Notice that there are many functions defined in this file whose names contain the word operator, such as operator+= and operator-.
    • Why are they here? In other words, what use are these? You might have to read about this in your C++ textbook.
    • Why, do you think, the developers created all of these operator functions?

  6. Find the implementation file for this interface and open it. What is its name?

  7. Find the implementation of operator< . Read it carefully.
    • Does it depend on any other user-defined functions? Which ones?

  8. Find the implementation of operator+ . This depends on many functions.
    • List the operator functions that it depends on.
    • What is unusual about this function? (Note for instructor: It is recursive, but the student may not realize this unless they study the code carefully.)


Deliverables

The student will hand in a completed form containing the answers to the given questions. This template file is a template with the questions and a rubric.

Assessment

The assignment can be graded in the traditional way, by a numeric score out of 100 possible points. The questions in the above template have suggested weights, but clearly the instructor is free to change the weights.

Grades on out-of-class assignments do not necessarily reflect how much a student has learned, for several reasons. To determine how well a student has learned about the actual C++ feature of overloaded operators and their use, as well as the GitHub related skills that should have been acquired, the instructor is better off by using in-class pop quiz given after the assignment is due. Therefore, no further assessment guidance is suggested here.


Comments

This activity is an active-learning approach to teaching about operator overloading and in-line functions. Students might express frustration because they are being asked to learn something before they have been taught about it by the instructor. They need a bit of patience.

Additional Information:

ACM BoK
Area & Unit(s)

Programming Languages/Object-Oriented Programming, Software Development Fundamentals/Fundamental Programming Concepts

ACM BoK
Topic(s)

Overloaded operators, in-line functions

Difficulty

Easy to moderate

Estimated Time
to Complete

2-3 hours

Environment /
Materials

Any platform with a modern Internet browser.

Author(s)

Stewart Weiss

Source

N/A

License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

CC license.png


Suggestions for Open Source Community

This can be adapted to many other language features and to other languages as well.

Personal tools
Namespaces
Variants
Actions
Events
Learning Resources
HFOSS Projects
Evaluation
Navigation
Toolbox