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: |
I recently watched a video about separating logic into different categories within your custom code.
It wasn't a PHP video, but the concept applies to any programming language or framework.
This was the final structure of the directories:
src/
Controllers/
Domain/
Persistence/
Properties/
Services/
It was described as using Controllers
for presentational logic, Domain
for domain logic, and Services
for application logic, and reminds me of a domain-driven design (DDD) approach to organising code.
I remember watching other older videos showing separating business and presentational logic in React into different components (if I remember correctly).
This isn't an approach I see in Drupal code, maybe more-so in other PHP framework-based projects like Symfony or Laravel.
It's something I've been thinking of trying, potentially on my website codebase.
Do you organise your code in this or a similar way?
If so, why?
What advantages does it bring?
format: full_html processed: |I recently watched a video about separating logic into different categories within your custom code.
It wasn't a PHP video, but the concept applies to any programming language or framework.
This was the final structure of the directories:
src/
Controllers/
Domain/
Persistence/
Properties/
Services/
It was described as using Controllers
for presentational logic, Domain
for domain logic, and Services
for application logic, and reminds me of a domain-driven design (DDD) approach to organising code.
I remember watching other older videos showing separating business and presentational logic in React into different components (if I remember correctly).
This isn't an approach I see in Drupal code, maybe more-so in other PHP framework-based projects like Symfony or Laravel.
It's something I've been thinking of trying, potentially on my website codebase.
Do you organise your code in this or a similar way?
If so, why?
What advantages does it bring?
summary: null field_daily_email_cta: { }