oliverdavies.uk/content/node.84a6f9be-759c-42ea-815b-6b29a90b7742.yml

77 lines
2.7 KiB
YAML

uuid:
- value: 84a6f9be-759c-42ea-815b-6b29a90b7742
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:26+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: |
Suffixing names
created:
- value: '2023-12-10T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:26+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2023/12/10/suffixing-names
langcode: en
body:
- value: |
<p>When writing code, it's common to suffix the class name with the type of class it is.</p>
<p>I do this often for most types of classes, such as Controllers, EventListeners, Factories, Repositories and Builders.</p>
<p>However, I don't always for value objects and data transfer objects (DTOs).</p>
<p>Also, I don't always suffix interfaces with <code>Interface</code>.</p>
<p>I've been re-reading the documentation for the Symfony Serializer component, which references both <code>NameConverterInterface</code> and <code>MyDto::class</code>.</p>
<p>Whilst it does make the names more verbose, it does clarify what the class is used for.</p>
<p>Symfony's coding standards and Drupal's PHP coding standards have conventions for this, but what do you think?</p>
<p>Do you add suffixes to your class or interface names, or do you prefer the simplified versions?</p>
format: full_html
processed: |
<p>When writing code, it's common to suffix the class name with the type of class it is.</p>
<p>I do this often for most types of classes, such as Controllers, EventListeners, Factories, Repositories and Builders.</p>
<p>However, I don't always for value objects and data transfer objects (DTOs).</p>
<p>Also, I don't always suffix interfaces with <code>Interface</code>.</p>
<p>I've been re-reading the documentation for the Symfony Serializer component, which references both <code>NameConverterInterface</code> and <code>MyDto::class</code>.</p>
<p>Whilst it does make the names more verbose, it does clarify what the class is used for.</p>
<p>Symfony's coding standards and Drupal's PHP coding standards have conventions for this, but what do you think?</p>
<p>Do you add suffixes to your class or interface names, or do you prefer the simplified versions?</p>
summary: null
field_daily_email_cta: { }