CS2 Data Structures Activity

(Difference between revisions)
Jump to: navigation, search
(Directions:)
(Directions:)
Line 21: Line 21:
  
 
=== Directions: ===
 
=== Directions: ===
# Go to the [https://github.com/openmrs/openmrs-module-reportingcompatibility/blob/master/api/src/main/java/org/openmrs/module/reportingcompatibility/reporting/export/DataExportFunctions.java DataExportFunctions.java] class and examine the import statements found at the beginning of the file. Provide the class names of four data structures that are used in DataExportFunctions.java. Note: You may need to refer to the Java APIs; also, note that an interface is not a class.
+
# Go to the [https://github.com/openmrs/openmrs-module-reportingcompatibility/blob/master/api/src/main/java/org/openmrs/module/reportingcompatibility/reporting/export/DataExportFunctions.java DataExportFunctions.java] class and examine the import statements found at the beginning of the file. Provide the class names of four data structures that are used in DataExportFunctions.java. Note: You may need to refer to the Java APIs and should recall that an interface is not a class.
 
# Go to the following link to answer the questions below:   
 
# Go to the following link to answer the questions below:   
 
#: <ToDo: insert URL here>
 
#: <ToDo: insert URL here>
Line 28: Line 28:
 
## Given,
 
## Given,
 
#::'''Map<String, int> populations = new HashMap<String, int> ();'''
 
#::'''Map<String, int> populations = new HashMap<String, int> ();'''
#::populations.put(“11530”, 27273);
+
#::'''populations.put(“11530”, 27273);'''
#::populations.put(“28601”, 50026);
+
#::'''populations.put(“28601”, 50026);'''
#::populations.put(“38111”, 41742);
+
#::'''populations.put(“38111”, 41742);'''
 
+
 
#::What would the following call to the get method return?
 
#::What would the following call to the get method return?
 +
#::'''System.out.println(“The population for Memphis, TN is “ + populations.get(“38111”);'''
  
#::System.out.println(“The population for Memphis, TN is “ + populations.get(“38111”);
+
# The data structures within this class are used in a multitude of ways and it is likely that you are unfamiliar with some of the syntax. Go to the [https://github.com/openmrs/openmrs-module-reportingcompatibility/blob/master/api/src/main/java/org/openmrs/module/reportingcompatibility/reporting/export/DataExportFunctions.java#L754 clearMap method]. You will find that it uses wildcard characters (‘?’).
 
+
## Briefly explain what each of the following means and explain the benefit of using them.
##These data structures are used in a multitude of ways and it is likely that you are unfamiliar with some of the syntax. The clearMap method (link below) uses wildcard characters (‘?’).
+
## ‘?’ (hint: wildcards)
https://github.com/openmrs/openmrs-module-reportingcompatibility/blob/master/api/src/main/java/org/openmrs/module/reportingcompatibility/reporting/export/DataExportFunctions.java#L754
+
## ‘? Extends Map’
a. Briefly explain what each of the following means and explain the benefit of using them.
+
## Determine whether each of the following calls to clearMap is valid or invalid. If a call is invalid, explain why.  
i. ‘?’ (hint: wildcards)
+
## Map =
ii. ‘? Extends Map’
+
### Call 2
b. Determine whether each of the following calls to clearMap is valid or invalid. If a call is invalid, explain why.  
+
### Call 3
i. Map =
+
### Call 4
ii. Call 2
+
## Write a Javadoc comment for the clearMap method.
iii. Call 3
+
# The getLastEncounterAttr method (link below) declares two reference variables, types and encounterTypes.  
iv. Call 4
+
c. Write a Javadoc comment for the clearMap method.
+
4. The getLastEncounterAttr method (link below) declares two reference variables, types and encounterTypes.  
+
 
https://github.com/openmrs/openmrs-module-reportingcompatibility/blob/master/api/src/main/java/org/openmrs/module/reportingcompatibility/reporting/export/DataExportFunctions.java#L352-L387
 
https://github.com/openmrs/openmrs-module-reportingcompatibility/blob/master/api/src/main/java/org/openmrs/module/reportingcompatibility/reporting/export/DataExportFunctions.java#L352-L387
a) Can you determine what type of object each refers to? If yes, then specify the type of object. If not, then in your opinion what type of object it is most likely to refer to. Explain your answer.
+
## Can you determine what type of object each refers to? If yes, then specify the type of object. If not, then in your opinion what type of object it is most likely to refer to. Explain your answer.
b) Why do you think these data structures were selected by the developers?
+
## Why do you think these data structures were selected by the developers?
5. Analysis question…I’m not sure this method is a good choice for analysis. Thoughts? Would some other code segment within this class be better suited for this type of question?
+
# Analysis question…I’m not sure this method is a good choice for analysis. Thoughts? Would some other code segment within this class be better suited for this type of question?
  
 
=== Deliverables: ===
 
=== Deliverables: ===

Revision as of 20:53, 17 August 2016

Title CS2 Data Structures Activity
Overview Using the HFOSS OpenMRS project to illustrate the use of data structures in a complex system
Prerequisite Knowledge CS1 and Java
Learning Objectives
  1. Describe the difference between a data structure and the implementation thereof.
  2. Explain the application of a data structure in a specific large complex software system.
  3. Evaluate tradeoffs in selection of data structures.
  4. Analyze the time complexity of an algorithm that uses the data structure.

Background:

Data structures are widely used in the development of large complex software systems. The decision to use a particular data structure is made by the programmer or in many cases a development team. Several factors must be considered including storage requirements, time requirements of the various operations that will be performed on the data, and usage patterns (i.e. the number of deletions, insertions, updates, etc.).

This activity will explore a class within the OpenMRS code base where a number of data structures are utilized. As such, it is expected that the students will have some general knowledge about the OpenMRS project.

Directions:

  1. Go to the DataExportFunctions.java class and examine the import statements found at the beginning of the file. Provide the class names of four data structures that are used in DataExportFunctions.java. Note: You may need to refer to the Java APIs and should recall that an interface is not a class.
  2. Go to the following link to answer the questions below:
    <ToDo: insert URL here>
    1. What is meant by the term key? The term value?
    2. If you wanted to store student information such as a student id, name, major, and gpa, which one of these would you choose as a key? Given that choice of a key, which of the remaining ones could be used as the associated value?
    3. Given,
    Map<String, int> populations = new HashMap<String, int> ();
    populations.put(“11530”, 27273);
    populations.put(“28601”, 50026);
    populations.put(“38111”, 41742);
    What would the following call to the get method return?
    System.out.println(“The population for Memphis, TN is “ + populations.get(“38111”);
  1. The data structures within this class are used in a multitude of ways and it is likely that you are unfamiliar with some of the syntax. Go to the clearMap method. You will find that it uses wildcard characters (‘?’).
    1. Briefly explain what each of the following means and explain the benefit of using them.
    2. ‘?’ (hint: wildcards)
    3. ‘? Extends Map’
    4. Determine whether each of the following calls to clearMap is valid or invalid. If a call is invalid, explain why.
    5. Map =
      1. Call 2
      2. Call 3
      3. Call 4
    6. Write a Javadoc comment for the clearMap method.
  2. The getLastEncounterAttr method (link below) declares two reference variables, types and encounterTypes.

https://github.com/openmrs/openmrs-module-reportingcompatibility/blob/master/api/src/main/java/org/openmrs/module/reportingcompatibility/reporting/export/DataExportFunctions.java#L352-L387

    1. Can you determine what type of object each refers to? If yes, then specify the type of object. If not, then in your opinion what type of object it is most likely to refer to. Explain your answer.
    2. Why do you think these data structures were selected by the developers?
  1. Analysis question…I’m not sure this method is a good choice for analysis. Thoughts? Would some other code segment within this class be better suited for this type of question?

Deliverables:

Written artifact to Instructor


Assessment:

How will the activity be graded?

How will learning will be measured?

Include sample assessment questions/rubrics.

Criteria Level 1 (fail) Level 2 (pass) Level 3 (good) Level 4 (exceptional)
The purpose of the project
Why the project is open source

Comments:

What should the instructor know before using this activity?

What are some likely difficulties that an instructor may encounter using this activity?


Additional Information:

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 Varies, designed as one assignment or laboratory activity
Materials/Environment Access to OpenMRS codebase
Author Who wrote this activity?
Source POSSE 201405 Workshop Activity
License Licensed CC BY-SA

Suggestions for Open Source Community:

Suggestions for an open source community member who is working in conjunction with the instructor.



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

CC license.png

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