The Payroll System was introduced in Robert C. Martins Book Agile Software Development [ASD] and describes a batch Payroll System.
In preparation of Section 3 and its subsequent chapters of the book, I decided to implement the Use Cases following agile principles and compare then later on with the solution provided by Robert.
A brief description of the Payroll System
- The system consists of a database of the Employees and their associated data.
- The system must pay each Employee:
- The correct amount has to be paid.
- The Employee must be paid on time.
- The Employee must be paid by the method they specify.
- Various deductions must be taken from the Employee's pay.
The following technical- and (non)-functional-criteria can be observed from this introduction: The database tells us that data needs to be persisted by the application. A functional criteria would be correct payment considering various deductions, and a non-functional criteria would be the fact that Employees must be paid on time: It involves functional criteria in the form of "the system must compute the date when an Employee gets paid", but it also includes non-functional criteria: The system must be stable and highly available to make sure transactions (i.e. money transfer) are executed on time.
To get a better understanding of the domain we're dealing with, let's extract and guess a few domain keywords that we're probably using throughout the project and which should become terms of the Ubiquitous Language we're establishing for the project:
- Payroll, Employee, Payment, Salary, Deduction, Accounting
Since we're implementing a Payroll System, the system will be part of an Accounting Domain. Let's see if we can get a grasp of a more specific Core Domain during the course of the implementation.
I stick to the following rules while implementing my solution with the knowledge I have from the brief introduction of the system
- One Use Case equals one sprint.
- Pragmatism over Dogmatism.
- Implement the Use case given only the information the Use Case provide. A Use Case represents a Story that has to be implemented in this sprint. There is no knowledge of the requirements given future Use Cases.
- Establish a healthy code base with a test-first approach.
- Avoid Needless Complexity by strictly following Rules 2, 3 and 4.
A note on testing
There is not a scripting system for the acceptance tests: The acceptance tests described with the Use Cases are written with PHPUnit.
I consider the inputs defined with the acceptance tests as an important requirement for the user interface. The user interface will be leveraged to the testing environment.
The source code is maintained at https://github.com/thorstensuckow/payroll. Branches are named after the use case:
The main branch will always reflect the source code from the most recent sprint. Once a Use Case is marked as "finished", code in this branch will not be changed anymore, and required code changes of the finished branch's code base will be implemented with the most recent sprint and. Tags and Versions will reflect this.
Use Cases and Articles
This is an ongoing article series.
📄️ 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: