85 lines
3.4 KiB
YAML
85 lines
3.4 KiB
YAML
|
uuid:
|
||
|
- value: 21f3f75a-e37f-44b6-81f5-337cc11e5eac
|
||
|
langcode:
|
||
|
- value: en
|
||
|
type:
|
||
|
- target_id: daily_email
|
||
|
target_type: node_type
|
||
|
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
|
||
|
revision_timestamp:
|
||
|
- value: '2025-05-11T09:00:18+00:00'
|
||
|
revision_uid:
|
||
|
- target_type: user
|
||
|
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
|
||
|
revision_log: { }
|
||
|
status:
|
||
|
- value: true
|
||
|
uid:
|
||
|
- target_type: user
|
||
|
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
|
||
|
title:
|
||
|
- value: 'Why you need layers in your application code'
|
||
|
created:
|
||
|
- value: '2024-03-04T00:00:00+00:00'
|
||
|
changed:
|
||
|
- value: '2025-05-11T09:00:18+00:00'
|
||
|
promote:
|
||
|
- value: false
|
||
|
sticky:
|
||
|
- value: false
|
||
|
default_langcode:
|
||
|
- value: true
|
||
|
revision_translation_affected:
|
||
|
- value: true
|
||
|
path:
|
||
|
- alias: /daily/2024/03/04/why-you-need-layers-in-your-application-code
|
||
|
langcode: en
|
||
|
body:
|
||
|
- value: |
|
||
|
<p>You need to add an integration with a new service or supplier to your application code.</p>
|
||
|
|
||
|
<p>You should avoid writing code that interacts directly with that service or supplier - a.k.a tightly-coupled code.</p>
|
||
|
|
||
|
<p>What if you change to a different service or supplier in the future?</p>
|
||
|
|
||
|
<p>What if they release a new version of their API that includes breaking changes?</p>
|
||
|
|
||
|
<p>If your code is tightly coupled to a single implementation, you'd need to rewrite the code, and there wouldn't be a way to easily switch from the old version to the new one.</p>
|
||
|
|
||
|
<p>By introducing an adapter layer, you make your code more loosely coupled.</p>
|
||
|
|
||
|
<p>You can have multiple implementations, with one for each different supplier, service, or version.</p>
|
||
|
|
||
|
<p>You can have a consistent interface and API for every implementation, making them hot-swappable and making it easy to switch between different implementations.</p>
|
||
|
|
||
|
<p>If you change supplier or they release a new version, you write a new implementation for it and switch when you're ready.</p>
|
||
|
|
||
|
<p>Also, as every implementation satisfies a common interface, it's easy to make a fake implementation that you can use for testing.</p>
|
||
|
|
||
|
|
||
|
format: full_html
|
||
|
processed: |
|
||
|
<p>You need to add an integration with a new service or supplier to your application code.</p>
|
||
|
|
||
|
<p>You should avoid writing code that interacts directly with that service or supplier - a.k.a tightly-coupled code.</p>
|
||
|
|
||
|
<p>What if you change to a different service or supplier in the future?</p>
|
||
|
|
||
|
<p>What if they release a new version of their API that includes breaking changes?</p>
|
||
|
|
||
|
<p>If your code is tightly coupled to a single implementation, you'd need to rewrite the code, and there wouldn't be a way to easily switch from the old version to the new one.</p>
|
||
|
|
||
|
<p>By introducing an adapter layer, you make your code more loosely coupled.</p>
|
||
|
|
||
|
<p>You can have multiple implementations, with one for each different supplier, service, or version.</p>
|
||
|
|
||
|
<p>You can have a consistent interface and API for every implementation, making them hot-swappable and making it easy to switch between different implementations.</p>
|
||
|
|
||
|
<p>If you change supplier or they release a new version, you write a new implementation for it and switch when you're ready.</p>
|
||
|
|
||
|
<p>Also, as every implementation satisfies a common interface, it's easy to make a fake implementation that you can use for testing.</p>
|
||
|
|
||
|
|
||
|
summary: null
|
||
|
field_daily_email_cta: { }
|