Experiential Coding (Anti) Patterns #1825
Replies: 12 comments
-
Cato Pattern: When someone who is supposed to be your ally does something without warning that suddenly makes your life more difficult. Example: a DBA who renames a column without telling you and the deployment you’ve been planning for weeks fails. |
Beta Was this translation helpful? Give feedback.
-
Decoy Pattern: When code looks like it's functional and doing the right thing, but actually it’s doing nothing or something else entirely – it leads you to a bad outcome. Example: a config parameter that tunes the behaviour you want, but it turns out the code doesn’t look at it. |
Beta Was this translation helpful? Give feedback.
-
Future-Me Pattern: when you knowingly leave a code problem for your future self. Example: When your wife reminds you that you said you’d fix that squeak and you tell her you’ll get around to it, what do you say? This pattern can be mitigated by creating tickets to get back to the problem at a future date. |
Beta Was this translation helpful? Give feedback.
-
Absolution Pattern: when you leave a coding problem for someone else because it seems like the right thing to do. Often prepended by a "TODO" or "FUTURE" comment in the code. If the person knows in his heart that he’s being lazy then this is a different pattern. |
Beta Was this translation helpful? Give feedback.
-
Fatalism Pattern: when you write code that you know is going to suck, but you don't care. “Let the world burn, I don’t care anymore” |
Beta Was this translation helpful? Give feedback.
-
Reinventing the Wheel Pattern: when you don't understand the existing code architecture so you write a parallel one. May also be called “Knowing Enough To Be Dangerous Pattern”. |
Beta Was this translation helpful? Give feedback.
-
Too Many Cooks Pattern: several devs in the same area of code making a big mess that ultimately doesn’t work. |
Beta Was this translation helpful? Give feedback.
-
Spaghetti Pattern: a convoluted code path due to poor structure or many changes added in without cleaning things up. |
Beta Was this translation helpful? Give feedback.
-
Kitchen Sink Pattern: code that does everything, in particular things that it doesn’t need to do. |
Beta Was this translation helpful? Give feedback.
-
Multiverse Pattern: the code works in some universes (but not ours, probably). Also known as “Works on my System Pattern”. |
Beta Was this translation helpful? Give feedback.
-
Rapture Pattern: everyone who knows about a certain area of code has left the project (because Google hired them away for 4x their salary). |
Beta Was this translation helpful? Give feedback.
-
Zero Gravity Toilet Pattern: when something that should be simple has too many/detailed steps, and if you get any of the steps wrong then you must start again. |
Beta Was this translation helpful? Give feedback.
-
Intro
I was exposed to these many years while working on legacy code with another (jaded?) developer. Since all of you have solid coding experience, you've probably seen many of these. While some of these can be serious (or at least very annoying) coding issues, we took this all lightly and gave these code antipatterns fun names. To be clear, the point is to avoid these patterns.
Feel free to comment on any of them, or provide a textbook example of any of them, or add your own. Enjoy, and try to write good code 😃
Note that a web search easily finds other websites that cover some of these and more, eg:
Related Principle
Coding Golden Rule: Code unto others as you would have others code unto you. (Google for details.)
Beta Was this translation helpful? Give feedback.
All reactions