I am building a web page for a business application. The page displays the information of a project. There are several buttons whose display depend on the data of the project, let's say it depends on codeC.
I am wondering what is recommended to handle the business rules of these buttons.
Option 1 :
Java Enumeration that lists the valid codeC values or exposes a method that calculates whether the button should be displayed.
- Pros: fast implementation
- Cons: the codeC values may change or new codeC values may appear... this would require a rebuild. This rebuild would probably be needed for other reasons anyway, but still... it is not as scalable as the database solution.
Option 2 : Database table with the name of the button, its title, the codeC values that allow its display... + a helper class that would calculate for any button if it should be displayed...
- Pros: scalability, factorization.
- Cons: logic is held in different places, not as fast as option 1