Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
I am trying to design a small module of an HR system. It deals with applying for leave. The organization I am designing for has branches in various countries. Each branch has their own norms when it comes to applying for leave.

Each branch manages their own database of employees. Moreover you'd find that the structure/attributes differ from branch to branch for an employee. Do I have to model an employee for each branch?

Now each employee has associated forms (UI) with it depending on the branch that employee is from. Basically this form (usually a web interface or page) has to have input fields corresponding to the underlying employee object's properties (or fields).

When I googled up for patterns for an HR system the visitor pattern showed up. Not sure if this can do well. In the future we may have different centers, different rules, etc.
Posted

deostroll wrote:
Do I have to model an employee for each branch?


You could put your common attribute inside an employee class and then inherit that class.


deostroll wrote:
Now each employee has associated forms (UI) with it depending on the branch that employee is from.


How about MVC?
 
Share this answer
 
Have a look at the MVP / MVC pattern to build your UI / view.
 
Share this answer
 
Perhaps people like yourself need to stop worrying about patterns and learn how to program instead. Using patterns will NOT cause your project to be any better, if you don't have the skills to write good code in the first place. The right question to ask is, do any patterns seem like they apply here, not, what patterns can I use here, if they fit or not ?

As far as I am concerned, the MVC pattern works best if the underlying architecture allows for it ( you don't say at all what sort of app this will be ), AND then it is best used where the view or controller are likely to change. Beyond that, it's a bit convoluted in a world where the controller and view are intimately tied to each other, and is way overused today as some sort of magic bullet.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900