DEV Community

The Rule Pattern: When Facts Meet Rules (opens in new tab)

Discussed on DEV

1. The Pain Came First Everyone knows this. You open a class and there it is: the if-else chain. Twenty branches. Thirty. Some with comments like // TODO: refactor from 2019. You know you shouldn't touch anything — side effects, unknown dependencies, missing tests. So you add your case. At the bottom. After the last else. And you go home with that bad feeling that you've become part of the problem. 2. My First Attempt — And Why It Didn't Make Me Happy Eventually, I'd had enough. I refactored ...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help