68 lines
3 KiB
YAML
68 lines
3 KiB
YAML
uuid:
|
|
- value: 56776268-7d1e-47b3-8c3a-bb7dc5d102f4
|
|
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:16+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: 'Avoiding nesting'
|
|
created:
|
|
- value: '2024-04-07T00:00:00+00:00'
|
|
changed:
|
|
- value: '2025-05-11T09:00:16+00:00'
|
|
promote:
|
|
- value: false
|
|
sticky:
|
|
- value: false
|
|
default_langcode:
|
|
- value: true
|
|
revision_translation_affected:
|
|
- value: true
|
|
path:
|
|
- alias: /daily/2024/04/07/avoiding-nesting
|
|
langcode: en
|
|
body:
|
|
- value: |
|
|
<p>One of my goals when coding is to reduce the amount of nesting in the code I write.</p>
|
|
|
|
<p>I mean both in my PHP code where if conditions and foreach loops can be nested within each other, and CSS and Sass files, which support nesting CSS rules.</p>
|
|
|
|
<p>My aim is to have a maximum of two or three levels of indentation, though sometimes this isn't possible.</p>
|
|
|
|
<p>Doing so where I can, though, makes my code easier to read and understand and encourages other clean code approaches, such as having small and well-named functions.</p>
|
|
|
|
<p>In CSS or Sass, avoiding nesting makes it easier to find a rule I'm looking for instead of having to find how rules have been nested or names have been concatenated - making it hard to search or grep for a string.</p>
|
|
|
|
<p>This approach is part of "object callisthenics", which was introduced by Jeff Bay and includes other approaches that I like to follow, such as not using the <code>else</code> keyword and other good practices that I like to try and implement when possible.--</p>
|
|
|
|
|
|
format: full_html
|
|
processed: |
|
|
<p>One of my goals when coding is to reduce the amount of nesting in the code I write.</p>
|
|
|
|
<p>I mean both in my PHP code where if conditions and foreach loops can be nested within each other, and CSS and Sass files, which support nesting CSS rules.</p>
|
|
|
|
<p>My aim is to have a maximum of two or three levels of indentation, though sometimes this isn't possible.</p>
|
|
|
|
<p>Doing so where I can, though, makes my code easier to read and understand and encourages other clean code approaches, such as having small and well-named functions.</p>
|
|
|
|
<p>In CSS or Sass, avoiding nesting makes it easier to find a rule I'm looking for instead of having to find how rules have been nested or names have been concatenated - making it hard to search or grep for a string.</p>
|
|
|
|
<p>This approach is part of "object callisthenics", which was introduced by Jeff Bay and includes other approaches that I like to follow, such as not using the <code>else</code> keyword and other good practices that I like to try and implement when possible.--</p>
|
|
|
|
|
|
summary: null
|
|
field_daily_email_cta: { }
|