ソースを参照

Update README.md

Git-Leon 7 年 前
コミット
bf9b67f259
共有1 個のファイルを変更した37 個の追加1 個の削除を含む
  1. 37
    1
      README.md

+ 37
- 1
README.md ファイルの表示

@@ -129,6 +129,7 @@
129 129
 * Create a `ZipCodeWilmington` singleton.
130 130
 	* The class should declare a field that references the instance of `Students` called `students`.
131 131
 	* The class should declare a field that references the instance of `Instructors` called `instructors`.
132
+	* The class should define a method `hostLecture` which makes use of a `Teacher teacher, double numberOfHours` parameter to host a `lecture` to the composite `people` field in the `students` reference.
132 133
 	* The class should define a method `hostLecture` which makes use of a `long id, double numberOfHours` parameter to identify a respective `Instructor` to host a `lecture` to the composite `people` field in the `cohort` reference.
133 134
 
134 135
 -
@@ -136,8 +137,43 @@
136 137
 * Create a `TestZipCodeWilmington` class.
137 138
 	* Create a `testHostLecture` method which ensures that each of the `Student`'s `totalStudyTime` instance variable is incremented by the specified `numberOfHours` upon invoking the `.hostLecture` method.
138 139
 
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+-
149
+# Notice the Design Flaw - Odd Casting Issues
150
+* You may have noticed that the `findById`, and `hostLecture` methods require an intermediate [casting trick](https://stackoverflow.com/questions/5289393/casting-variables-in-java).
151
+* To remedy this issue, we can _generify_ the `People` class.
152
+
153
+# Part 9.1 - Modify `People` class
154
+* [Parameterize](https://stackoverflow.com/questions/12551674/what-is-meant-by-parameterized-type) the `People` signature to enfore that it is a container for objects of type `E` such that `E` is a subclass of `Person`.
155
+* Modify `people` field to enforce that is a container of objects of type `E`.
156
+* Modify the `add` method to ensure that it handles object of type `E`.
157
+* Modify the `getArray` method to ensure that it returns an object of type `E[]`.
158
+* Modify the `findById` method to ensure that it returns an object of type `E`.
159
+
160
+# Part 9.2 - Modify `People` subclasses
161
+* Modify the `Students` class signature to ensure that it is a subclass of `People` of parameterized type `Student`.
162
+* Modify the `Instructors` class signature to ensure that it is a subclass of `People` of parameterized type `Instructor`.
163
+
164
+# Part 9.3 - Refactor `ZipCodeWilmington` class
165
+* Refactor the `hostLecture` method in the `ZipCodeWilmington` class by removing any intermediate _casting trick(s)_.
166
+
167
+# Part 9.0 - Test refactored classes.
168
+* Ensure that the `TestStudents`, `TestInstructors`, `TestPeople`, `TestZipCodeWilmington` classes were no affected by the refactor.
169
+
170
+
171
+
172
+
173
+
174
+
139 175
 -
140
-# Notice the Design Flaw
176
+# Notice the Design Flaw - Non-Intuitive Orientation
141 177
 * You may have notice that `findById` makes it difficult to intuitively identify _which_ `Person` object is being returned.<br>
142 178
 Additionally, it's challengaing to ensure **every** `Person` instance has a unique ID amongst its respective `People` subclass.<br>
143 179
 To remedy this issue, we redesign and refactor.