Add daily email for 2024-09-05
find vs. get
This commit is contained in:
parent
9e864b893d
commit
9cd77f718a
|
@ -367,6 +367,7 @@ RewriteRule ^symfony$ https://connect.symfony.com/profile/opdavies [R=301]
|
||||||
RewriteRule ^symfony-server$ /articles/running-drupal-with-symfony-local-server [R=301]
|
RewriteRule ^symfony-server$ /articles/running-drupal-with-symfony-local-server [R=301]
|
||||||
RewriteRule ^symfonylive$ /articles/live-blogging-symfonylive-london [R=301]
|
RewriteRule ^symfonylive$ /articles/live-blogging-symfonylive-london [R=301]
|
||||||
RewriteRule ^symposium$ https://symposiumapp.com/u/opdavies [R=301]
|
RewriteRule ^symposium$ https://symposiumapp.com/u/opdavies [R=301]
|
||||||
|
RewriteRule ^tailwind$ /presentations/taking-flight-with-tailwind-css [R=301]
|
||||||
RewriteRule ^tailwind-css-talk$ /presentations/taking-flight-tailwind-css [R=301]
|
RewriteRule ^tailwind-css-talk$ /presentations/taking-flight-tailwind-css [R=301]
|
||||||
RewriteRule ^tailwind-repos$ https://github.com/opdavies?utf8=%E2%9C%93&tab=repositories&q=tailwindcss [R=301]
|
RewriteRule ^tailwind-repos$ https://github.com/opdavies?utf8=%E2%9C%93&tab=repositories&q=tailwindcss [R=301]
|
||||||
RewriteRule ^tailwind-talk$ /presentations/taking-flight-with-tailwind-css [R=301]
|
RewriteRule ^tailwind-talk$ /presentations/taking-flight-with-tailwind-css [R=301]
|
||||||
|
|
34
source/_daily_emails/2024-09-05.md
Normal file
34
source/_daily_emails/2024-09-05.md
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
title: find vs. get
|
||||||
|
date: 2024-09-05
|
||||||
|
permalink: daily/2024/09/05/find-vs-get
|
||||||
|
tags:
|
||||||
|
- software-development
|
||||||
|
- static-analysis
|
||||||
|
- podcast
|
||||||
|
cta: ~
|
||||||
|
snippet: |
|
||||||
|
find vs. get
|
||||||
|
---
|
||||||
|
|
||||||
|
This week, I spoke with [Dave Liddament][2] to record an upcoming episode of [the Beyond Blocks podcast][1].
|
||||||
|
|
||||||
|
In that conversion, we started to talk about conventions, specifically unwritten conventions used within projects.
|
||||||
|
|
||||||
|
Dave mentioned on some of his projects, they have a convention for when to use `get` or `find` method prefix names.
|
||||||
|
|
||||||
|
For example, in a `UserRepository` class, a method like `findUserByEmail()` implies that a matching user may not be found.
|
||||||
|
|
||||||
|
Alternatively, `getUserByEmail()` implies that you're getting a user and will always be one found and returned.
|
||||||
|
|
||||||
|
This interested me and I [found a blog post by Thomas Uhrig][0] on find vs. get, which I've read since the recording.
|
||||||
|
|
||||||
|
In the context of the episode, we discussed how conventions like this can be codified and written down and checkable with static analysis tools, but it got me thinking about conventions I've consciously or unconsciously followed, as well as the impact of changing a small word in a method name on its behaviour.
|
||||||
|
|
||||||
|
What about you?
|
||||||
|
|
||||||
|
Do you have similar conventions that you follow in your applications?
|
||||||
|
|
||||||
|
[0]: https://tuhrig.de/find-vs-get
|
||||||
|
[1]: {{site.url}}/podcast
|
||||||
|
[2]: https://www.daveliddament.co.uk
|
Loading…
Reference in a new issue