Use Case 1 - Adding a new employee.
A new employee is added by the receipt of an
AddEmp transaction. This transaction contains the employee's name, addess, and assigned employee number. The transaction has the following three forms:
$ AddEmp <EmpId> "<name>" "<address>" "<address>" H <hourly-rate>
$ AddEmp <EmpId> "<name>" "<address>" "<address>" S <monthly-salary>
$ AddEmp <EmpId> "<name>" "<address>" "<address>" C <hourly-rate> <commission-rate>
The employee's record is created with its field assigned appropriately.
An error in the transaction structure
If the transaction structure is inappropriate, it is printed out in an error message, and no action is taken.
The Use Case describes various ways how Employee-data can be added to the system.
AddEmp could be implemented as a polyadic function that receives 6 to 7 arguments,
describing an Employee's personal information and the salary the Employee_receives, and
the type of _salary (
C). If the salary type is
C, an Employee requires an additional
Obviously, errors happening during transactions must be treated with care, appropriate error messages should be displayed.
This is particularly important for the input provided by the client, e.g. salary types must be validated as well as the
rates; also, check if
empIds already exist and prevent multiple occurences of the same
- validate user input:
empId: existing? valid format?
salaryType: is it one of
salaryshould probably be greater than
- display error messages if a transaction failed
Accountant - adds a new Employee to the system.
The Actor carrying out the Use Case is an Accountant. Of course, any other "role" would be eligible, but since the system exists in a Domain dealing with Accounting, I assume Accountant describes (a part of the) target audience of the system quite well.
The initial design should consist of 3 parts: An Application Layer, a Repository for managing transaction-calls
Payrollexists in the Application Layer and is the main entry point for interacting with the system, in the form of a traditional Facade.
- The Repository would be the
EmployeeRepositoryand encapsulates the required infrastructure for persisting
- The Entity would be the