Task System mode
RT, the company needs to add a task system to the original site, that is, when the user to meet a certain requirements can receive a certain reward, I now have two ideas:
1 Modify other parts of the code, in the user to do tasks related to the place to add code, record the user's action.
2 Almost does not modify the original code, as far as possible by querying the database to determine whether the user reached a task completion requirements.
May I ask which of the two methods is good, why, and ask the experienced predecessors to answer the following.
Reply to discussion (solution)
Modify existing code as few as possible + database storage task completion status
Encapsulates the task system, leaving an interface to query the completion state of the task (and, of course, the task, and so on.
Call this interface at the critical operational location to query the user's task completion status and processing in the task system (you can pass the current position as a parameter to the task system, the task system according to the location (page) and the different tasks and task completion of the different to carry out the corresponding processing)
Otherwise the code will be more and more chaotic? New systems on the existing system personal recommendations are in a similar way, the existing system to modify the code, add an interface to correspond to the new system
The condition that the user reaches a certain requirement is not very clear.