demonstrate the contract and the specification of the GetCourseByCourseID() of the CourseList class.
Week 6/CRC Card - CourseList.docx
Front:
|
Class Name: CourseList
|
ID: 2 |
Type: Concrete, Domain
|
|
Description:
This class maintains a list of courses that the Staff can use to retrieve a course.
|
Associated Use Cases:
Maintain Course |
|
|
Responsibilities
GetCourseByCourseID (string id)
|
Collaborators
|
Back:
|
Attributes:
For testing purposes, the CourseList will have an array CourseArray that is initialized with some test courses when an instance of the CourseList is created. This way we will have an already populated CourseList class with a number of Course objects. Here is a demonstration in Java:
class CourseList { public Course[] CourseArray = { new Course (“CIS 400”, "OO Analysis & Design", 4, "Important class", “CIS 110”) , new Course (“CIS 150A” , "VB.NET Programming", 4, "Good Introduction to programming", “CIS 100”) , new Course (“CIS 150B”, "C# Programming with labs", 4, "Follow-up to CIS 100", “CIS 100”) };
public CD GetCourseByCourseID (string id) { // ToDO } }
|
|
Relationships: Generalization (a-kind-of):
Aggregation (has-parts):
Other Associations: Course
|
Week 6/Method Contract TEMPLATE.docx
Contracts TEMPLATE
|
Class Name: |
ID: |
|
|
Clients (Consumers):
|
||
|
Associated Use Cases:
|
||
|
Description of Responsibilities:
|
||
|
Arguments Received:
|
||
|
Type of Value Returned: |
||
|
Pre-Conditions:
1. |
||
|
Post-Conditions:
1. |
Week 6/Method Specification TEMPLATE.docx
PSSM Case Study, complete
Method Specification TEMPLATE
|
Method Name: |
Class Name: |
ID: |
|
Contract ID: |
Programmer: |
Date Due: |
|
Programming Language: X Visual Basic Smalltalk C++ Java |
||
|
Triggers/Events:
|
||
|
Arguments Received: Data Type: |
Notes: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Messages Sent & Arguments Passed: ClassName.MethodName: |
Data Type: |
Notes: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Argument Returned: Data Type: |
Notes: |
|
|
|
|
|
|
Algorithm Specification: |
1
Week 6/Week6.iLab.Directions.docx
|
|
i L A B O V E R V I E W |
|
|
|
The design phase of the SRS project is in full swing and every developer on the team is assigned a group of packages to work on and to complete the design details of the classes in the package. To help speed up the design process, you—as the software architect of the project—were assigned the task of providing a sample method contract and a sample method specification to demonstrate to your team how these two documents are developed.
You decided to use the CourseList and the Course classes for your demonstrations. The CourseList class maintains and populates the current list of courses that the end user is working with to pick a course from a list of courses. You will demonstrate the contract and the specification of the GetCourseByCourseID() of the CourseList class.
The GetCourseByCourseID() method searches the current list of courses for a course whose CourseID matches the ID supplied to the method. If a matched course is found, the course object is returned by the GetCourseByCourseID() method; otherwise a null value is returned, indicating there are no matching courses.
|
Deliverables |
1. Method contract of the GetCourseByCourseID() method of the CourseList class
2. Method specification of the GetCourseByCourseID() method of the CourseList class
3. Must be in Visual Basic
4. Must be in Standard English
|
|
i L A B S T E P S |
|
|
STEP 1: Create a Public Method Contract |
1. In Doc Sharing, download and review the CRC Card for the CourseList class, the Maintain Course Sequence Diagram, and the Class Diagram to prepare for your deliverables this week.
2. In Doc Sharing, download the Method Contract Template and use it for your deliverables this week.
3. Create the method contract for the GetCourseByCourseID() method of the CourseList class.
|
STEP 2: Create a Method Specification |
1. In Doc Sharing, download the Method Specification TEMPLATE and use it for your deliverables this week.
2. Create the method specification for the GetCourseByCourseID() method of the CourseList class.
|
STEP 3: Save and Upload |
Copy and paste all assignments (method contract and method specification) into one Word document. Save your document with the file name YourLastName_CIS339_Lab6.
Submit your assignment to the Dropbox located on the silver tab at the top of this page.
|
|
Week 6/Week6.Sequence Diagram for Maintain Course Use Case.docx
Sequence Diagram for the Maintain Course Use Case
Week 6/Week6.SRS.Help.docx
Download the CourseList CRC, the sequence diagram, and the class diagram that are in your week 6 supporting documents category in doc sharing.
A class has been created called CourseList. Review the CourseList CRC you just downloaded. In the CourseList CRC, you will see a CourseList Array. That array will be used by the GetCourseByCourseID as input to search for a course in that array. The array’s rows (elements) are made up of course objects.
Here is the text from the scenario summary in the iLab directions. Use this information as well as the above information to help create your method contract and method specification documents.
The GetCourseByCourseID() method searches the current list of courses for a course whose CourseID matches the ID supplied to the method. If a matched course is found, the course object is returned by the GetCourseByCourseID() method; otherwise a null object is returned, indicating there are no matching courses.
Think about what this method will return. The array is composed of course object entries. So if there is a match, you want to return the course object. If there is no match, you want to return a null object.
Here is some help for the Method Contract:
Clients: What objects will use this method? In other words, what objects will call this method? Check out your CRCs and Class Diagram. Associated Use Cases: What use case or use cases will use this method? Check out the the sequence diagram.
Description of Responsibilities: What does this method do? Do not describe how it will do it. Keep it simple and brief. You can get that information from above or in the iLab tab.
Arguments Received: What argument or arguments does this method need? What are their data types? In other words, what variable or variables would you need in the argument list as input to this method? What does the method need to know?
Type of Value Returned: What attribute will this method return? What will be its data type? If you want to return several variables, you probably would want to return an object. Remember that the Course Array is composed of object elements. You will see that array in the CourseList CRC.
Pre-Condition: What must be true before this method is to be executed. In other words, if the pre-conditions are not met, the method will not be able to be executed. This has nothing to do with any mistake a user can make when executing it like entering an ID number that does not exist. It has to do with the arguments being sent to the method. That would be a normal exception within the flow of the method. That ID could be there the next day. Pre-condition code in a method would be written at the beginning of the method. It would not be part of the logic of the method. Some examples of a pre-condition would be that the argument being passed to the method cannot be null. Or an array argument being passed cannot have a length of zero (empty). Or the range of values within an argument being passed must be between 0 and 31.
Post-Condition: What does this method accomplish? What will be true after it executes. It can be several things. What data has been changed and passed back to the calling module?
Here is some help for the Method Specification:
Here again is the scenario from your iLab tab:
The GetCourseByCourseID() method searches the current list of courses for a course whose CourseID matches the ID supplied to the method. If a matched course is found, it is returned by the GetCourseByCourseID() method; otherwise a null value is returned, indicating there are no matching courses.
Use the above scenario as well as your finished contract to build your method specification. Use the above scenario to write your method specification Structured English algorithm. Remember that a CourseArray is specified in the CourseList CRC. Remember that the array has objects as entries in it.
Messages Sent & Arguments Passed: – If a method executes any other methods, then you would list them here. If the method does not execute any other methods, then this section would be left blank. Use the sequence diagram in the week 6 supplements to help you with this portion of the specification. Also watch my iConnect Live lecture to learn about this section.
Algorithm: Use structured English. Use the above scenario and what you know from the CourseList CRC to write it. Think in terms of a loop. Remember that the array is composed of COURSE OBJECTS.
No need to write any precondition code.