How much logic is too much logic in a PHP enum
カートのアイテムが多すぎます
ご購入は五十タイトルがカートに入っている場合のみです。
カートに追加できませんでした。
しばらく経ってから再度お試しください。
ウィッシュリストに追加できませんでした。
しばらく経ってから再度お試しください。
ほしい物リストの削除に失敗しました。
しばらく経ってから再度お試しください。
ポッドキャストのフォローに失敗しました
ポッドキャストのフォロー解除に失敗しました
-
ナレーター:
-
著者:
Have you ever added a method to an enum and then wondered if you just turned it into something it was never meant to be?
In the latest episode of the No Compromises podcast, we discuss where to draw the line when adding methods and logic to PHP enums.
We trace the evolution from magic strings to constants to interfaces, and explain why enums were the missing piece PHP needed all along.
We also cover when label methods and data structure helpers belong on an enum, why Eloquent queries cross a line, and how to avoid turning a simple enum into a bloated helper class.
- (00:00) - Why magic strings and constants fall short
- (01:43) - How PHP enums replaced interface constants
- (02:26) - What methods belong on an enum
- (06:58) - The rule for keeping enum methods focused
- (10:44) - Silly bit
Join developers who think carefully about clean code decisions in the No Compromises community.
adbl_web_anon_alc_button_suppression_t1
まだレビューはありません