|
|
|
|
126
|
* Create a `TestInstructors` class.
|
126
|
* Create a `TestInstructors` class.
|
127
|
|
127
|
|
128
|
|
128
|
|
|
|
129
|
+-
|
129
|
### Part 9.1 - Create `ZipCodeWilmington` Class
|
130
|
### Part 9.1 - Create `ZipCodeWilmington` Class
|
130
|
* Use `Part 7` as a reference.
|
131
|
* Use `Part 7` as a reference.
|
131
|
* Create a `ZipCodeWilmington` singleton.
|
132
|
* Create a `ZipCodeWilmington` singleton.
|
|
|
|
|
152
|
* You may have noticed that the `findById`, and `hostLecture` methods require an intermediate [casting trick](https://stackoverflow.com/questions/5289393/casting-variables-in-java).
|
153
|
* You may have noticed that the `findById`, and `hostLecture` methods require an intermediate [casting trick](https://stackoverflow.com/questions/5289393/casting-variables-in-java).
|
153
|
* To remedy this issue, we can _generify_ the `People` class.
|
154
|
* To remedy this issue, we can _generify_ the `People` class.
|
154
|
|
155
|
|
|
|
156
|
+-
|
155
|
### Part 10.1 - Modify `People` class
|
157
|
### Part 10.1 - Modify `People` class
|
156
|
* [Parameterize](https://stackoverflow.com/questions/12551674/what-is-meant-by-parameterized-type) the `People` signature to enforce that it is a container for objects of type `E` such that `E` is a subclass of `Person`.
|
158
|
* [Parameterize](https://stackoverflow.com/questions/12551674/what-is-meant-by-parameterized-type) the `People` signature to enforce that it is a container for objects of type `E` such that `E` is a subclass of `Person`.
|
157
|
* Modify `people` field to enforce that is a container of objects of type `E`.
|
159
|
* Modify `people` field to enforce that is a container of objects of type `E`.
|
|
|
|
|
159
|
* Modify the `getArray` method to ensure that it returns an object of type `E[]`.
|
161
|
* Modify the `getArray` method to ensure that it returns an object of type `E[]`.
|
160
|
* Modify the `findById` method to ensure that it returns an object of type `E`.
|
162
|
* Modify the `findById` method to ensure that it returns an object of type `E`.
|
161
|
|
163
|
|
|
|
164
|
+-
|
162
|
### Part 10.2 - Modify `People` subclasses
|
165
|
### Part 10.2 - Modify `People` subclasses
|
163
|
* Modify the `Students` class signature to ensure that it is a subclass of `People` of parameterized type `Student`.
|
166
|
* Modify the `Students` class signature to ensure that it is a subclass of `People` of parameterized type `Student`.
|
164
|
* Modify the `Instructors` class signature to ensure that it is a subclass of `People` of parameterized type `Instructor`.
|
167
|
* Modify the `Instructors` class signature to ensure that it is a subclass of `People` of parameterized type `Instructor`.
|
165
|
|
168
|
|
|
|
169
|
+-
|
166
|
### Part 10.3 - Refactor `ZipCodeWilmington` class
|
170
|
### Part 10.3 - Refactor `ZipCodeWilmington` class
|
167
|
* Refactor the `hostLecture` method in the `ZipCodeWilmington` class by removing any intermediate _casting trick(s)_.
|
171
|
* Refactor the `hostLecture` method in the `ZipCodeWilmington` class by removing any intermediate _casting trick(s)_.
|
168
|
|
172
|
|
|
|
173
|
+-
|
169
|
### Part 10.0 - Test refactored classes.
|
174
|
### Part 10.0 - Test refactored classes.
|
170
|
* Ensure that the `TestStudents`, `TestInstructors`, `TestPeople`, `TestZipCodeWilmington` classes were no affected by the refactor.
|
175
|
* Ensure that the `TestStudents`, `TestInstructors`, `TestPeople`, `TestZipCodeWilmington` classes were no affected by the refactor.
|
171
|
|
176
|
|
|
|
|
|
180
|
Additionally, it's challenging to ensure **every** `Person` instance has a unique ID amongst its respective `People` subclass.<br>
|
185
|
Additionally, it's challenging to ensure **every** `Person` instance has a unique ID amongst its respective `People` subclass.<br>
|
181
|
To remedy this issue, we redesign and refactor.
|
186
|
To remedy this issue, we redesign and refactor.
|
182
|
|
187
|
|
|
|
188
|
+-
|
183
|
### Part 11.1 - Create `Educator` enum
|
189
|
### Part 11.1 - Create `Educator` enum
|
184
|
* Create an enum named `Educator`.
|
190
|
* Create an enum named `Educator`.
|
185
|
* The enum should implement `Teacher`.
|
191
|
* The enum should implement `Teacher`.
|
186
|
* The enum should have an enumeration for each of the instructors represented in the `Instructors` class.
|
192
|
* The enum should have an enumeration for each of the instructors represented in the `Instructors` class.
|
187
|
* The enum should have an _empty nullary constructor_.
|
193
|
* The enum should have an _empty nullary constructor_.
|
188
|
-
|
|
|
|
|
194
|
+
|
|
|
195
|
+-
|
189
|
### Part 11.0 - Test `Educator`
|
196
|
### Part 11.0 - Test `Educator`
|
190
|
* Use `Part 5` as a reference.
|
197
|
* Use `Part 5` as a reference.
|
191
|
|
198
|
|
|
|
199
|
+
|
|
|
200
|
+-
|
192
|
### Part 12.1 - Modify `Instructor` Class
|
201
|
### Part 12.1 - Modify `Instructor` Class
|
193
|
* Annotate the constructor with `@Deprecated`.
|
202
|
* Annotate the constructor with `@Deprecated`.
|
194
|
* This constructor should be commented with `//TODO - Remove dependencies`
|
203
|
* This constructor should be commented with `//TODO - Remove dependencies`
|
|
|
|
|
197
|
* Remove any calls being made to the deprecated construcor.
|
206
|
* Remove any calls being made to the deprecated construcor.
|
198
|
* Remove the deprecated constructor from the class.
|
207
|
* Remove the deprecated constructor from the class.
|
199
|
|
208
|
|
|
|
209
|
+
|
|
|
210
|
+-
|
200
|
### Part 12.0 - Test `Instructor`
|
211
|
### Part 12.0 - Test `Instructor`
|
201
|
* Refactor `TestInstructor` to support the newly created `Instructor` constructor.
|
212
|
* Refactor `TestInstructor` to support the newly created `Instructor` constructor.
|
202
|
* Ensure the tests were not affected by the refactoring.
|
213
|
* Ensure the tests were not affected by the refactoring.
|