Refactorer la classe 'Person', pour faire la distinction entre les agents et les administrateurs
Description
The fr.unantes.sce.people.Person
class manages both agents and administrators. This behavior comes with several issues:
- Exceptions have to be handled when using
Person::getCalendar
,Person::setCalendar
orPerson::addTravelTo
, whether the person roles are known or not, - Adding a new role may cause issues and will require a lot of maintenance,
- There is no way to statically differentiate an administrator from an agent.
Proposed implementation
Create Person
subclasses for agents and administrators, and delegate specific behaviors to subclasses. Move the role-specific methods to their corresponding subclass instead of throwing exceptions.