jeudi 20 décembre 2018

Application design: Providing object metadata?

This question might be quite broad, but I'm hoping for some answer that can push me in some direction.

Let's say I'm building an event calendar. The client fetches events from the server. Each event has a date, and after the date has passed, the event status is considered done. So there is some logic involved determining whether the event is done or not, in this example it's simple. Imagine that layer of logic being much more complex, where should the application execute this logic?

Option 1 – Store in database

So one option would be storing it in the database. The downside would of course be in keeping the data consistent and it would be necessary to use triggers to keep it up to date.

Option 2 – Keep logic on server

Every time the client requests the data, do the logic on the server and send it in response. The downside here is where the client would do many small writes to database so that the server would have to execute this logic every time, which could be quite intensive.

Option 3 – Keep logic on client

The client fetches the data and then does the logic. The downsides here is that the client requires all necessary data to do the logic, data it might not have. It also requires each client (web & apps) to implement its own logic when the data should really be platform agnostic.

Aucun commentaire:

Enregistrer un commentaire