mercredi 22 août 2018

How to properly extend Clean Architecture entities?

I am trying to use Clean Architecture on my Android app project. I was still trying to grasp all the concepts but I think I got most of the basics down. However there are still specifics that I can't wrap my head around.

For instance, say I have a WeatherData entity on my domain layer. This entity has the following fields:

  • temperature
  • location
  • humidity
  • pressure
  • timezone

However, let's assume I decided to change my weather API and in the new API, I got additional fields such as:

  • precipitation probability
  • cloud cover
  • uv index
  • ozone

The latter fields are not available in my previous API but I would like to display them on my app as an additional feature. So the obvious action is that I should update my domain entity to include those additional fields. However, based on what I understood on the principles of Clean Architecture, this completely violates the dependency rule in which the domain object should not in any way be affected by the outer layers such as the data layer in where my API resides.

So is there a way where I can extend the features of my domain object while still making it framework and API agnostic?

Aucun commentaire:

Enregistrer un commentaire