Reputation: 291
Good day
I have an application that creates, reads and updates records but does not delete any records. This is because the client does not want any of the records to be deleted. Do you think this is an acceptable software design?
Thanks in advance
Upvotes: 0
Views: 784
Reputation: 7882
I think we still need Delete because there will be some records we don't want to see anymore. Delete here is just about logical remove(Soft Delete), we set Deleted field is true. The deleted record still resides in database and we can always retrieve it later.
It is a common design as storage these days is no longer a big problem.
Upvotes: 1
Reputation: 96600
That is quite an ordinary requirement. There are valid reasons why they need this. First they may need to be able to capture point in time data. For instance a sales rep may be evaluated based on how many of the people who attend his presentations are the customers the company wants targeted or not. So if John Smith is no longer a target, but was in March when the event was held, you would not want to delete John Smith, you would want to display begin and end dates.
There are also regulatory/legal reasons why you might not want to delete records. In accounting systems for instance, even incorrect costs are NEVER deleted, they are backed out with a negative entry. This is so auditors can follow the exact actions that happened.
There are times to question the requirements, but this is not one of them. It is perfectly valid to make sure that no records are delted. In fact if this is a requirement, I would put a delete trigger on every table to ensure no records can be deleted. There are ways to delete that do not come from the application, so it would be irresponsible to skip this step. You might also consider if auditing is needed.
I would make sure to have views of the active records of each table and make sure devs only use the view (unless they actually need the soft deleted records) and don't have bugs caused by forgetting to put in a where clause to get only active ones.
Upvotes: 1