skip to Main Content

I’m working with AWS SDK and was wondering if it is worth abstracting over it. By abstracting i mean:

  • Creating a library where i would define interfaces for IQueue, IFileStorage, …
  • Creating implementations for those interfaces like SqsQueue for IQueue or S3Storage for IFileStorage

I’m considering two cases:

  • A project realised according to DDD, developed in the Ports & Adapters architecture. I would think that in the Application layer this would be correct approach.

  • A big data project aimed at populating a data warehouse. No complex domain model here. I’m not sure about the benefits here. Automated tests would be more readable and clear. Maybe mocking would be easier with less complex interfaces. This would come at a price of a lot of boiler plate being created in the interfaces library.

What would be the best approach in both those cases?

2

Answers


  1. As you already pointed out: it is a trade-off decision. When focusing on portability or simply the cost of changing such a dependency in future, abstracting the dependency (AWS SDK) away is a good idea. The downside is additional code but maybe also performance.
    Nevertheless, in most cases it is probably better to have your application (at least its core) decoupled from the "hosting environment/framework".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search