Add daily email for 2024-09-19
The two ways of writing PHP code
This commit is contained in:
parent
306d463ac2
commit
7be26febec
27
source/_daily_emails/2024-09-19.md
Normal file
27
source/_daily_emails/2024-09-19.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: The two ways of writing PHP code
|
||||
date: 2024-09-19
|
||||
permalink: daily/2024/09/19/the-two-ways-of-writing-php-code
|
||||
tags:
|
||||
- software-development
|
||||
- drupal
|
||||
- php
|
||||
cta: ~
|
||||
snippet: |
|
||||
How do you write your PHP code?
|
||||
drupal_planet: true
|
||||
---
|
||||
|
||||
Something that came up in my discussion with Dave Liddament for the Beyond Blocks podcast was that there seem to be two ways of writing PHP code.
|
||||
|
||||
One is writing strict code by enabling strict typing, using parameter and return types, and leveraging tools like PHPStan at a high level to analyze code.
|
||||
|
||||
The other is no not use types and to use a more "duck typing" approach.
|
||||
|
||||
The term "visual debt" came from a video discussing the pros and cons of these approaches.
|
||||
|
||||
The same can be said for JavaScript and TypeScript, but PHP can do both and gives the Developer the choice of how they write their code.
|
||||
|
||||
I prefer writing strict code and for my code to be as explicit as possible, but I appreciate not everyone does and I like that PHP caters for both.
|
||||
|
||||
How do you write your PHP code?
|
Loading…
Reference in a new issue