Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vlambo3/templatemethod---employment
This repository features two branches: one with the original salary liquidation code and another showcasing the same process restructured using the Template Method pattern. Explore the benefits of enhanced code organization and reusability. Includes JUnit 5 tests for validating email routing logic.
https://github.com/vlambo3/templatemethod---employment
java junit-test junit5 template-method template-method-design-pattern template-method-pattern
Last synced: 25 days ago
JSON representation
This repository features two branches: one with the original salary liquidation code and another showcasing the same process restructured using the Template Method pattern. Explore the benefits of enhanced code organization and reusability. Includes JUnit 5 tests for validating email routing logic.
- Host: GitHub
- URL: https://github.com/vlambo3/templatemethod---employment
- Owner: vlambo3
- Created: 2024-06-26T00:33:11.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-17T15:03:15.000Z (5 months ago)
- Last Synced: 2024-07-17T18:29:40.213Z (5 months ago)
- Topics: java, junit-test, junit5, template-method, template-method-design-pattern, template-method-pattern
- Language: Java
- Homepage: https://github.com/vlambo3/TemplateMethod---Employment
- Size: 79.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Explanation of the Program in the Main Branch
Our program is responsible for managing employee salary liquidation. To accomplish this task, we follow a specific process involving three key steps:
### 1. Calculate the Corresponding Salary:
- For permanent employees, the salary is calculated based on a basic salary, with applicable discounts and bonuses.
- For contract employees, the salary is calculated based on the number of hours worked and the specific hourly rate.### 2. Print or Generate Salary Receipts:
- Permanent employees receive a printed salary receipt.
- Contract employees receive a digital salary receipt.### 3. Deposit the Corresponding Amount:
- Regardless of the employee type, the calculated salary is deposited into the employee's bank account.In summary, the process we perform is called `calculateTotalSalary()`, which includes the steps of calculation, printing, and depositing the salary. Each employee has a name, surname, and a bank account number used for salary deposits. Permanent employees have additional information such as basic salary, discounts, and bonuses, while contract employees have the number of hours worked and the hourly rate.
## Usage of the Template Method Design Pattern in the Template Method Branch
In the `template-method` branch, we have implemented the Template Method design pattern to simplify and better structure the salary liquidation process. This pattern allows us to define the skeleton of an algorithm in a base class and delegate the implementation of specific steps to subclasses, promoting code reuse and extensibility.