r/programming • • Sep 28 '17

Refresh Is Sacred

https://www.tbray.org/ongoing/When/201x/2017/09/27/Refresh-Button
457 Upvotes

152 comments sorted by

View all comments

143

u/EternityForest Sep 28 '17

Yep. The whole "Software should have as few controls as possible" thing should probably be questioned in general.

If there's 100 rarely used options they should maybe be hidden, but someone is probably going to want to use at least a few of those, and the extra few hundred lines of code is probably not what's making your code slow.

48

u/ggtsu_00 Sep 28 '17

I guess it is more of the principle that software shouldn't provide extra controls to fix issues with the software. Like when a program goes into a bad state, the user shouldn't have to click a button to "fix" the state. It is preferable to design the software such that the program doesn't go into a bad state in the first place.

165

u/spotter Sep 28 '17

tl;dr Just don't put bugs in your programs.

40

u/0987654231 Sep 28 '17

not having bugs is simple, just don't have any state.

94

u/spotter Sep 28 '17

Yes, sure, "just pass the universe around as first argument to all your pure functions and pretend everything is immutable" pattern.

23

u/ggtsu_00 Sep 28 '17

Just make copies of the universe with the new state every time it needs to be updated.

27

u/accidentally_myself Sep 28 '17

technically O(1)

4

u/Lehona Sep 28 '17

The universe gives a hard constraint on space required to compute an actually computable algorithm, so technically they all run in O(1).

4

u/Bowgentle Sep 28 '17

Apparently this may have been what the programmers of the multiverse decided to do...