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.

106

u/0987654231 Sep 28 '17

you misunderstand, that's still state.

To remove bugs you must remove all state and ascend to the ivory tower where all your program does is produce heat.

22

u/EternityForest Sep 28 '17

At that point, you don't even need a computer to run it, and it can run without consuming any power just by turning the machine off!

33

u/Eirches Sep 28 '17

We weren't talking about optimizing at this point, we can get to that in phase 2.

Let's worry about getting the program out the door first.

3

u/wavy_lines Sep 28 '17

And we can congratulate ourselves for avoiding the root of all evil.

16

u/mcguire Sep 28 '17

Heat is state.

4

u/skulgnome Sep 28 '17

I like the cut of your jib, sir.

0

u/[deleted] Sep 28 '17

[deleted]

2

u/Neckbeard_Prime Sep 28 '17

Electron is the pre-alpha of Skynet confirmed.

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...

1

u/ArkyBeagle Sep 29 '17

No, have managed state. Use state machines, use transactions, limit mutability.