Software architecture

Conceptually, our code has three layers, as shown in the following diagram:

These layers are as follows:

  • REST: This package accepts the HTTP requests and converts them into function calls in the business logic. It then converts the business logic response back into HTTP.
  • Business Logic: This is where the magic happens. This layer uses the external service and data layer to perform the business functions.
  • External Services and Data: This layer consists of code that accesses the database and the upstream services that provides the currency exchange rates.

I used the word conceptually at the beginning of this section because our import graph shows a slightly different story:

As you can see, we have a quasi-fourth layer with the config and logging packages, and what's worse, everything seems to depend on them. This is likely going to cause us problems somewhere down the road.

There is one less obvious problem that is shown here. See the link between the rest and data packages? This indicates that our HTTP layer depends on the data layer. This is risky because they have different life cycles and different reasons to change. We will look at this and some other nasty surprises in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.226.66