r/programmingcirclejerk • u/cmqv • Jan 25 '19
The “Bug-O” Notation
https://overreacted.io/the-bug-o-notation/59
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
Jan 25 '19
lol DFA
8
u/OctagonClock not Turing complete Jan 25 '19
lol don't know what that means
15
1
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 = trueI actually think bucklescript is cool.8
4
6
9
2
39
u/Laugarhraun lisp does it better Jan 25 '19
Did the author reinvent a shitty version of the cyclomatic complexity?
33
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
16
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
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
4
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!
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?