Fork me on GitHub
#clojure-uk
<
2021-06-10
>
paulspencerwilliams06:06:49

Do others find that the greatest developer insights are gained when not at the keyboard? I’ve been developing a simple rules engine recently, and spent some time developing specific calculations, but I was never happy with the abstractions I’d used and there was too much duplication. My time remaining on the story is nearly up, so I thought it was good enough. But during breakfast whilst watching the news, and not thinking at all about the project, a different abstraction hit me. I’ve got about 3 hours to implement it which should be enough time. But why, oh why didn’t I see this yesterday whilst looking at the code!

Aron07:06:41

can I take a guess? does the new solution involve dependency inversion?

paulspencerwilliams08:06:17

Haha, actually it does as I’m in C# land. That is dependency injection - not IoC containers thank goodness!

thomas09:06:50

I tend to have my best ideas when having a shower in the morning....

thomas09:06:02

so should I stand under the shower all day? 😉

Aron11:06:50

You can have this problem an in any language, not just in classical hierarchical languages 🙂 And that's why you can solve it when you are not in front of the screen, because when you are looking at the code, you are following the existing dependency relations, while if you are not looking at it, your mind can jump around. The reason for this effect is not that somehow we think better when we are not in front of the computer, but it's two conditions acting on us at once: 1. existing code has some implicit assumption that requires questioning 2. we do not stop thinking about work when we are away from it. If you think about it, we would have good ideas about work anyway, it's remarkable only when first we tried to solve the same problem consciously and we didn't succeed. In that sense, taking breaks when stuck is great, and the more stuck you are the bigger break you make the better 🙂 So it's more about "why we can't solve it immediately if it's so easy the subconscious can do it?" and we can't do it for the same reason anyone gets lots in the woods, we took a bad turn, and we are walking in the wrong direction. To get out of the woods, we have to either walk back or find another way out.

2
2
djm06:06:45

I’m still waiting to have any great insights, but good ideas come to me when afk from time to time

seancorfield06:06:34

This often happens to me — usually when I’m in the shower!

💯 7
yogidevbear06:06:56

Morning. I have the same thing happen often too. The essence of hammock driven development I suppose 😄

paulspencerwilliams06:06:42

Yeah, I’ve had that a few times. That’s generally pretty convenient as I can usually hold on the idea for a few times. My worst time was when I was riding at a downhill mountain bike park where I don’t take my phone as 1. http://1.it will get broken when I fall off 2. there’s no need to have a phone as there’s marshals around for safety I subconsciously realised how to fix a problem that I’d been facing the week before, but had no way of recording it so promptly forgot it. I remembered during the drive home that I’d had the idea, but couldn’t remember the actual solution. I never did….

😞 3
djm07:06:00

In the shower, and before falling asleep are where it happens for me. I’m as likely to forget that I even had an idea than to know that I’ve forgotten it, if the latter

mccraigmccraig07:06:31

+1 shower insights

jasonbell07:06:06

Morning

👋 3
Jakob Durstberger08:06:55

I think I never had a single great insight or original thought in my life. I just mostly try to name things the best I can and put things that look like they belong to each other close together. I do sometimes come back to code and find better names or structures but never anything that I would call an insight.

Aron11:06:53

this is probably more about how we use words and language, an insight could be that "i don't need to use two loops here" or something silly like that 😄

Jakob Durstberger14:06:35

Yeah maybe. I had a couple of those 😅

paulspencerwilliams08:06:27

I should have said mediocre insight btw 😉

😂 8
Conor08:06:21

I simply think about the problem and write the answer down (actually, I do find I get ideas about how to do things the shower)

Conor08:06:33

Maybe it's massaging the scalp that does it

Jordan Robinson09:06:47

for me it's always going for lunch

mccraigmccraig09:06:02

i think i might become spherical if going for lunch was my inspiration trigger 😬

😆 4
Jordan Robinson10:06:30

yeah it doesn't help 😅

thomas09:06:49

having a walk is also good

paulspencerwilliams09:06:00

I’ve read a little about how stress can limit your creative thinking, so if you’re stressed about solving an issue, your constrained mind won’t be able to think laterally about it. I know i’ve tried the same thing over and over when desperately trying to get a confusing test passing or similar, my mind seems laser targeted on the one ‘solution’ that’s been proven to fail! I think it’s related to fight or flight - the brain becomes optimised on doing on repeatable thing well.

Aron11:06:50

You can have this problem an in any language, not just in classical hierarchical languages 🙂 And that's why you can solve it when you are not in front of the screen, because when you are looking at the code, you are following the existing dependency relations, while if you are not looking at it, your mind can jump around. The reason for this effect is not that somehow we think better when we are not in front of the computer, but it's two conditions acting on us at once: 1. existing code has some implicit assumption that requires questioning 2. we do not stop thinking about work when we are away from it. If you think about it, we would have good ideas about work anyway, it's remarkable only when first we tried to solve the same problem consciously and we didn't succeed. In that sense, taking breaks when stuck is great, and the more stuck you are the bigger break you make the better 🙂 So it's more about "why we can't solve it immediately if it's so easy the subconscious can do it?" and we can't do it for the same reason anyone gets lots in the woods, we took a bad turn, and we are walking in the wrong direction. To get out of the woods, we have to either walk back or find another way out.

2
2
paulspencerwilliams11:06:43

I suppose your summary relates somewhat to the sunk cost fallacy. WIP code that’s aiming to solve the issue but doesn’t is both an asset (we know this doesn’t work) but also a liability (how close to a solution is it). Just because I’ve written the code one way, I must ensure I’m prepared to, and have enough security to throw it away. Most likely through small and frequent git commits.

Aron11:06:01

That's been nicely put, if I may say so :D

paulspencerwilliams17:06:34

Well there you go, there’s interesting biology going on in our heads