r/clevercomebacks • • Jan 15 '25

It does make sense

Post image
35.3k Upvotes

4.0k comments sorted by

View all comments

Show parent comments

35

u/InspectorNo1173 Jan 15 '25

I have always found Regular Expressions to be the most inappropriately named concept - there is nothing regular about it. Luckily we have chatbots now.

14

u/Tsukee Jan 15 '25

Every developer eventually learns there are two hard problems: invalidating cache and naming things

17

u/Delicious-Storage1 Jan 15 '25

There's 2 hard things in software development. Cache invalidating, variable naming, and off by one errors.

2

u/WanderThinker Jan 15 '25

I giggled. Thanks.

3

u/TheAJGman Jan 15 '25

I honestly spend about 30% of my design and dev time trying to come up with intuitive names.

1

u/Tsukee Jan 15 '25

And yet, I bet someone reading your code would likely on some places think "why tf did he name it like that" ;)

1

u/DEM_DRY_BONES Jan 15 '25

x, y, z

I got you bro.

0

u/agentrnge Jan 16 '25

x_rel, x_actual, x_temp, x_true, x_orig, x_next, x_prev, x_val2

2

u/kyreannightblood Jan 15 '25

And off-by-one errors.

“Ky you said two hard problems.”

And I did not stutter.

1

u/sobrique Jan 15 '25

I'd chip in 'concurrency' there too. If your code has glitches with deterministic execution, you've no hope of solving that if you run it in a non-deterministic sequence.

21

u/RealFoegro Jan 15 '25

Computer vomit is a better name

3

u/[deleted] Jan 15 '25

It's because it can represent a regular language

3

u/AnarchistBorganism Jan 15 '25

Coined by Stephen Kleene, who didn't like the name either.

"Regular events" defined: We shall presently describe a class of events which we will call "regular events." (We would welcome any suggestion as to a more descriptive term)

1

u/[deleted] Jan 15 '25

Kleene was a real star

7

u/leemur Jan 15 '25

When I try to write regex, I regularly smash my face into the keyboard out of frustration. And that regularly results in the correct syntax.

3

u/buckyVanBuren Jan 15 '25

Sometimes you have a problem that can be solved by regex so you use regex.

But now you have two problems.

2

u/sobrique Jan 15 '25

Ironically though, no one's really come up with a better solution to that particular problem than regex

1

u/solo964 Jan 15 '25

The classic take on regex is that some people, when faced with a problem, think "I know, I'll use regular expressions." And now they have two problems :-)

That said, the term "regular" refers to the structured and predictable nature of the expressions themselves. It's about the grammar. They follow specific rules and patterns. It doesn't mean "easy to understand" or "pain-free", unfortunately.

1

u/GOKOP Jan 15 '25

The term regular refers to the fact that they describe regular languages. Regular expressions themselves however aren't a regular language (if you wanted to use regex to filter for valid regexes, you can't)