Timeline for Are "Distributed Enums" an Anti-pattern in non-OOP like they seem to be considered in OOP?
Current License: CC BY-SA 4.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 31, 2023 at 14:54 | comment | added | S.D. | "Distributed Enums" is quite a misleading name for the pattern. | |
| Mar 30, 2023 at 14:13 | comment | added | Silvio Mayolo | it relates to using enums in conditional statements. It sounds like the article you found was written by someone who's never used a language with pattern matching. In Rust or Scala, a match statement will check that it's used exhaustively, and if you add a new enum case, you get nice compile errors telling you what to update. It's still a downstream breaking change, but you can't break your own code by doing it. In fact, in Rust, there's an annotation you can add to your enum to forbid downstream code from assuming exhaustiveness, so that adding a new case is not a breaking change. | |
| Mar 30, 2023 at 13:37 | comment | added | Carsten S | @PieterB, or, if you can rely on that, have a switch without default and compiler warnings (as errors) if not all cases are covered. It is often better to catch these problems at compile time. | |
| Mar 30, 2023 at 12:33 | history | became hot network question | |||
| Mar 30, 2023 at 12:01 | comment | added | T. Sar | If anemic objects are good or bad is a strong font of contention. Some think they're fine, some don't. But they aren't certainly hated in general - it's more like the.. ah, dominant school of thought than an universal thing. | |
| Mar 30, 2023 at 10:00 | answer | added | sfiss | timeline score: -1 | |
| Mar 30, 2023 at 9:32 | comment | added | Doc Brown | You wrote "The explanations/solutions offered when I did research about this seemed to consistently be overtly OOP in character:" - but only provided a single link as reference. Can you give more references? For example #1, can you give a reference explaining the relationship of "distributed enums" with "anemic domain models"? | |
| Mar 30, 2023 at 9:10 | answer | added | Ewan | timeline score: 1 | |
| Mar 30, 2023 at 8:12 | comment | added | nvoigt | What happend to #4: "Test your code before you deploy the changes"? There is no amount of code you could add, no pattern or OOP magic that would replace testing. Ideally, automated testing. | |
| Mar 30, 2023 at 7:53 | answer | added | Doc Brown | timeline score: 9 | |
| Mar 30, 2023 at 7:49 | comment | added | Pieter B | Well, if working with enums, you need to make your code robust. So instead of case 1: dosomething case 2: dosomething; you have to write case 1: dosomething case 2: dosomething ELSE throw unexpectedEnumError. | |
| S Mar 30, 2023 at 2:45 | review | First questions | |||
| Mar 30, 2023 at 6:41 | |||||
| S Mar 30, 2023 at 2:45 | history | asked | user1713450 | CC BY-SA 4.0 |