Unleashing the Business Logic
Suppose there were a business rule stating that the amount of the per diem allowance depends on the income of the employee. How can we implement this rule in our application? We have to add a field income with an associated property to the Employee class.
Now we can simply add the logic into the PerDiemAllowance class:
if (travel.Employee.Income > 50000)
// apply higher rates
// apply lower rates
We don't have to worry about how we can retrieve the Employee object this PerDiemAllowance object belongs to. We just write down the business logic of our objects and let NDO do the rest.
This solution is part of the tutorial samples. You can find the tutorial source code in the Tutorial folder beneath your NDO installation folder. The code up to here is placed in the Directory NDOTravelExpenses-Step 6.
Now it’s your turn: Have fun with writing your own NDO based applications!