oliverdavies.uk/content/node.4c0b0072-4046-48aa-b481-84515c265ca0.yml

101 lines
3.4 KiB
YAML
Raw Normal View History

2025-07-10 00:14:12 +01:00
uuid:
- value: 4c0b0072-4046-48aa-b481-84515c265ca0
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:10+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: 'Do you separate your logic?'
created:
- value: '2024-06-11T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:10+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2024/06/11/do-you-separate-your-logic
langcode: en
body:
- value: |
<p>I recently watched <a href="https://www.youtube.com/watch?v=DuozyaJQQ1U">a video about separating logic</a> into different categories within your custom code.</p>
<p>It wasn't a PHP video, but the concept applies to any programming language or framework.</p>
<p>This was the final structure of the directories:</p>
<pre><code class="plain">src/
Controllers/
Domain/
Persistence/
Properties/
Services/
</code></pre>
<p>It was described as using <code>Controllers</code> for presentational logic, <code>Domain</code> for domain logic, and <code>Services</code> for application logic, and reminds me of a domain-driven design (DDD) approach to organising code.</p>
<p>I remember watching other older videos showing separating business and presentational logic in React into different components (if I remember correctly).</p>
<p>This isn't an approach I see in Drupal code, maybe more-so in other PHP framework-based projects like Symfony or Laravel.</p>
<p>It's something I've been thinking of trying, potentially on my website codebase.</p>
<p>Do you organise your code in this or a similar way?</p>
<p>If so, why?</p>
<p>What advantages does it bring?</p>
format: full_html
processed: |
<p>I recently watched <a href="https://www.youtube.com/watch?v=DuozyaJQQ1U">a video about separating logic</a> into different categories within your custom code.</p>
<p>It wasn't a PHP video, but the concept applies to any programming language or framework.</p>
<p>This was the final structure of the directories:</p>
<pre><code class="plain">src/
Controllers/
Domain/
Persistence/
Properties/
Services/
</code></pre>
<p>It was described as using <code>Controllers</code> for presentational logic, <code>Domain</code> for domain logic, and <code>Services</code> for application logic, and reminds me of a domain-driven design (DDD) approach to organising code.</p>
<p>I remember watching other older videos showing separating business and presentational logic in React into different components (if I remember correctly).</p>
<p>This isn't an approach I see in Drupal code, maybe more-so in other PHP framework-based projects like Symfony or Laravel.</p>
<p>It's something I've been thinking of trying, potentially on my website codebase.</p>
<p>Do you organise your code in this or a similar way?</p>
<p>If so, why?</p>
<p>What advantages does it bring?</p>
summary: null
field_daily_email_cta: { }