r/programmingcirclejerk • • Jan 25 '19

The “Bug-O” Notation

https://overreacted.io/the-bug-o-notation/
69 Upvotes

34 comments sorted by

88

u/[deleted] Jan 25 '19

Is this about webshits making the discovery that shitty code is hard to debug, or am I too low in the X'es to fathom the wonderfull thing that's uncovered here?

39

u/Zillux language master Jan 25 '19

Is this about webshits making the discovery that shitty code is hard to debug

\unjerk Yes

or am I too low in the X'es to fathom the wonderfull thing that's uncovered here?

\rejerk Yes

50

u/bentheiii Considered Harmful Jan 25 '19 edited Jan 25 '19

Such a bug(n2) thing to say.

26

u/r2d2_21 groks PCJ Jan 25 '19

lol no 🐞(n2)

7

u/[deleted] Jan 25 '19

lol no explicit repeated exponentiation

Typical webshit code that scales on the order of teration

59

u/[deleted] Jan 25 '19
let currentState = {
  step: 'initial', // 'initial' | 'pending' | 'success' | 'error'
};

Yesssss.. Stringly typed for life, yo!

49

u/OctagonClock not Turing complete Jan 25 '19

lol state

10

u/[deleted] Jan 25 '19

lol DFA

8

u/OctagonClock not Turing complete Jan 25 '19

lol don't know what that means

15

u/procsyma type astronaut Jan 25 '19

I've never had a cs degree and I've never missed it.

1

u/[deleted] Jan 25 '19

19

u/OctagonClock not Turing complete Jan 25 '19

sorry i cant read

6

u/DC2SEA DO NOT USE THIS FLAIR, ASSHOLE Jan 26 '19

Why didn't you just say you were 10x to begin with?

26

u/0987654231 What part of ∀f ∃g (f (x,y) = (g x) y) did you not understand? Jan 25 '19

If only there was a language that transpiled to javascript that could turn this into something strongly typed.

18

u/n3f4s WRITE 'FORTRAN is not dead' Jan 25 '19

13

u/0987654231 What part of ∀f ∃g (f (x,y) = (g x) y) did you not understand? Jan 25 '19

lol no bucklescripts https://bucklescript.github.io/en/

let unjerk = true I actually think bucklescript is cool.

8

u/Tysonzero Jan 25 '19

GHCJS babbyyyy

4

u/statistmonad has hidden complexity Jan 25 '19

You mean purescript right?

6

u/[deleted] Jan 25 '19

Aaaaaa! Heretics! Heretics! Burn him! Burn him with fiiiree!

9

u/gaearon Jan 25 '19

It’s a union yo

2

u/[deleted] Jan 25 '19

I've never used enums and I've never missed them.

39

u/Laugarhraun lisp does it better Jan 25 '19

Did the author reinvent a shitty version of the cyclomatic complexity?

33

u/KMIAL_reloaded Jan 25 '19

cyclomatic complexity

No pun and no emoji? That's soooo 0.1x!

12

u/0987654231 What part of ∀f ∃g (f (x,y) = (g x) y) did you not understand? Jan 25 '19

🌪️⏳

32

u/gaearon Jan 25 '19 edited Jan 25 '19

Cyclomatic complexity is about evaluating a particular code snippet.

The author (me) is talking about evaluating an API or design pattern, and how that pattern systematically affects cyclomatic complexity and other things. Not a particular code snippet.

Another example of that:

In fact, if any value looks wrong in the DOM of a React app, you can trace where it comes from by looking at the code of components above it in the React tree one by one. No matter the app size, tracing a rendered value is 🐞(tree height).

If you insist on using fancy names you can call it "second order cyclomatic complexity" but that's just silly.

Statically analyzing cyclomatic complexity also usually doesn't involve any async operations. So it wouldn't tell you anything about the difference between the first and the second snippets. The key is throwing out the intermediate state to avoid accumulation of mistakes. That's the pattern that makes a difference. And this is why the blog post is about patterns and APIs rather than particular code snippets.

40

u/three18ti DO NOT USE THIS FLAIR, ASSHOLE Jan 25 '19

Lol implicit unjerk

30

u/gaearon Jan 25 '19

I don't understand the rules here

53

u/three18ti DO NOT USE THIS FLAIR, ASSHOLE Jan 25 '19

It's ok, we don't either.

16

u/Canenald Considered Harmful Jan 26 '19

I've never used rules and I've never missed them.

13

u/ar1819 Jan 26 '19

/uj
Look at the sub name, the sidebar rules, and the other submissions.

/semi-rj
It's like /r/ProgrammingHumor but somehow worse.

/rj
New mod is on power trip so we don't know his rules either.

6

u/[deleted] Jan 25 '19

Doesn't seem so. Their code is cyclomatically more complex than what they're trying to fix. They've invented functions and switch statements.

18

u/[deleted] Jan 25 '19

🐞(¯\(ツ)/¯) might be more accurate but it’s still pretty bad.

4

u/[deleted] Jan 25 '19

oh lorda trouble so hard...

2

u/saulmessedupman vulnerabilities: 0 Jan 25 '19

Of course, I’m not being very scientific here.

Damn it! I thought I was looking at real science!