Correct design pattern for employee vacation program?

I have what seems like a simple employee time request web application that I have to do (C #, Silverlight or ASP.NET). An employee can request vacation time, illness time, maternity leave, compilation time, etc. (Maybe about 10 different types of holidays and may be more in the future), and their manager must approve each request.

It really turns into a mess with all the anomalies and such that I should expect. For example, people of different roles receive different vacation periods. Some people get leave, while others get everything from the start of the fiscal year (September 1). Employees have a bank in which they can store time and vacation time, but the size of these banks is limited and varies depending on the role of the employee. At any given time, I need to be able to see how much is left for an employee and how much is available for them. The biggest anomaly, in my opinion, is that an employee can change roles (i.e., switch to a manager at any given time and, therefore, start getting more vacation from this moment).

This is a rather difficult problem. My question is:

How do I create this? What is a good design template that can be used for this when I can be very flexible in the future?

Thanks!

+4
source share
6 answers

The starting design pattern will be MVC, so it's possible to use ASP.NET MVC as an inline;)

That way, you can have your own view code, separate from the more complex business rules that you have for different employees.

The strategy development template will be used to calculate their remaining time, so you can encapsulate the code to determine how many days are left based on them, if they are based on September 1 or another date.

-1
source

Politically, I would avoid the whole problem. You have to work with these people, and your application, fastening your vacation, can assure you.

In any case, I would say that tracking vacation accrual really goes beyond your scope, if it should not be an application for calculating salaries and benefits. Rather, I would allow the relevant group to indicate how much vacation the employee has at a given time, and send requests to managers and leave this to that.

+1
source

Given the complexity, it seems that you need to develop a process for calculating time around a rule system. You need to define rules that determine how holidays are awarded and apply them to each type of employee. Each rule affecting the generation of earnings should be implemented and applied as necessary.

Try to develop the rules in an object-oriented way: some rules can be applied in general, others are more specific.

You will need the opportunity to check your vacation time. When users are granted permission to use vacation time, use the ledger system to “withdraw” earned hours. Provide time using the rule system on a regular basis (daily), also using the register system.

0
source

If possible, do not track the clock at all:
Just save the organization chart and time type list and pass requests to the requesting supervisor

If you must keep track of the hours available:
This sounds like a pair of (possibly large) lookup tables in addition to the items listed above.

A circuit like the one below seems appropriate

(1) Employee --> (1) Position --> (1/*) TimeOffAllowances --> (1/*) AvailableTimeOff 

In this design, you should either have a row in TimeOffAllowances / AvailableTimeOff, with each column being a premium type or one row for each type. Thus, a one-to-many relationship or a one-to-one relationship. ( (1/*) in the above).

Then, of course, you will need an interface to enter all this data ....

0
source

Adopting the “what template design will work” approach is never a good way to solve a problem. The need that you described is really "how do I create an enterprise vacation management system." Design patterns do not solve this type of problem; design patterns are smaller. Enterprise systems typically use many different design patterns throughout the system. Design patterns are really just blue prints for an effective way to structure your code. Take a look at wikipedia for a deeper understanding of what problems are being addressed by design patterns.

Short answer: No, there is no design pattern for this.

I think you need to sit down and start documenting how the system will work, all the functions (no matter how big or how small), all the rules on how vacation time can be charged and booked before you start thinking about code, Before you start coding, you have a long way to go.

0
source

I would look more at something like Domain Driven Design to describe the domain you are working with. Start by looking at the nouns you use to describe the domain:

  • Employee
  • Manager
  • Role
  • Vacation time
  • Sick time
  • Maternity leave
  • Request

These nouns begin to define patterns that you can define in the business domain. Then I look at the verbs associated with each noun:

  • Employee can request time
  • Manager can Approve Request

These verbs now define your actions. You have a domain, but you also need an interface, I would wrap the domain inside the service level, even if the service is not located anywhere and uses the storage template to isolate your data access level.

As a side, take a look at how the Query Responsibility Responsibility Separation (CQRS) defines the interaction between your user interface and your domain.

0
source

All Articles