r/ProgrammerHumor • monkeyuser.com • Mar 06 '18

Focus

Post image
43k Upvotes

805 comments sorted by

View all comments

139

u/Reluxtrue Mar 06 '18

why is he thinking in 2 different diagram types mixed together?

331

u/vegancreampie Mar 06 '18

When you're in the zone you're in the zone.

64

u/Reluxtrue Mar 06 '18

I am just afraid he went to the wrong zone...

30

u/TheyCallMeATree Mar 06 '18

The Twilight Zone

10

u/mynoduesp Mar 06 '18

At least he had a cat

1

u/Shiroi_Kage Mar 06 '18

or The Danger Zone.

8

u/MrTripl3M Mar 06 '18

Nah, he went beyond the Zone. Beyond single diagram structure.

He was close to coding nirvana.

4

u/solar_compost Mar 06 '18

my man needs to load up draw.io

3

u/justablur Mar 06 '18

Yeah but you got a free battery check-up.

→ More replies (1)

7

u/[deleted] Mar 06 '18

Aka the Flow mental state.

3

u/vivs007 Mar 06 '18

I love that feeling. It's rare, and only comes after you've bashed in your head for a long time on the problem at hand that you're finally crystal clear on what needs to be coded. You start programming and initially you face some problems but eventually the code you commit starts to compile with minor syntax errors, nothing catastrophic.

I've only managed to get that feeling only a handful of times when I felt like a God at programming. Being able to think complex structures and methods to work them perfectly. At that time the only thing which slows you is the IDE GUI, and you wish there was some holographic keyboard which codes as you think.

34

u/KaamDeveloper Mar 06 '18

Fixing a bug which was caused by first design.

13

u/BorgiaCamarones Mar 06 '18

TFW you're in a nice state but you transition into a flow :(

13

u/Narfubel Mar 06 '18

He's ambi-diagramus

78

u/boldra Mar 06 '18

I once tried to explain to a non programming colleague what I have in my head when I'm in the zone.

  • data structures, their attributes and their scope
  • the code flow
  • the desired code flow
  • breakpoints in the debugger
  • what other debugging code I need to remove before I go productive
  • what's in my clipboard
  • what still needs to be commented in code
  • what files are open for editing
  • what will happen if I look through my history in an open shell
  • which browser windows have tests in them and which ones have search results in them
  • which git branch I'm on and whether I've committed recently
  • which issue is open in the issue tracker, and when I last updated it
  • what other programs are open

... to name just a few

14

u/birdhustler Mar 06 '18

Seems like a lot. Is there any way a programmer could outline what they're thinking of in anticipation of interruptions so that you don't forget where you were? Or is that just the nature of the job?

28

u/UncheckedException Mar 06 '18

Sometimes you’re so deep into working through the logic of an algorithm or data structure that you have to start (thinking) from scratch if someone interrupts you.

It’s like someone slapping your plate from your hands at a buffet. I mean I guess you could try to pick up the scattered food from the ground, but you really just have to get in line again.

26

u/MooseBlood Mar 06 '18

Not really. The only things a programmer usually writes down is diagrams and stuff that have to do with the logic of the program so that they can figure out how to do something. Most of the other things a programmer has to remember changes quite often and at random times and so it would not be worth writing down to remember.

17

u/[deleted] Mar 06 '18

It is a lot. This is not how I work at all.

I try to split my work into segments so I can worry about one thing at a time, instead of trying to have everything in my head all at the same time.

2

u/aaron552 Mar 06 '18

I find functional programming is good way to do this: if all I care about is the mapping from inputs to outputs (with no external and/or mutable state to worry about), I don't need as much in my head at once.

On the other hand trying to wrap my head around function composition and partial application of functions and/or higher-kinded types while being distracted is just as bad, if not worse.

5

u/MrJohz Mar 06 '18

Eh, most of these are things that aren't immediately relevant, but when you do need to know them, you should be able to look them up in half a second or so. For example, the program you write your code in should tell you which branch you're on, what files are open, and even prevent you from checking in debugging code. You can see what programs are open at all times just by looking down a few centimetres and checking out the taskbar. Finding the correct browser window is always a problem, but it's not usually a memory problem, and more of a faff-to-switch-windows problem.

This stuff is in your head, but in a fairly abstract way. It's sort of like how, after a while, you can generally drive into work completely automatically, without really noticing what you're doing. It takes a moment to get into that mindset when you set off, and it can be a bit of a surprise when you arrive and you'd be daydreaming, but generally it's not difficult.

A lot of the rest of this is stuff that shouldn't be around in your head for very long. For example, the contents of your clipboard should usually last for a few minutes at most, probably closer to a matter of seconds. Commenting should generally happen as you're writing code, to explain why you've done things in a certain way. Documentation is a bit harder, but a lot of companies that require documentation for public interfaces will also have programs called 'linters' that basically run through the code you're writing and remind you about things that aren't necessarily errors, but are generally unhelpful - like undocumented code.

The biggest things you're going to have in your head are data structures, and code flow. Both of these should be as explicit as possible. You should have some sort of type in your code that explicitly says "This is what a <User> looks like", or "This is what a <ShoppingCart> looks like". If you write code that doesn't match the definition of <User> or <ShoppingCart>, things should break really explicitly, so you can see "oh, I forgot that a user must always have an email address", or "oh, I forgot that you can't have fewer than 0 items in your shopping cart".

Similarly, code flow should be explicit as possible, and there's lots of ways of doing this, for example by having as few if-statements or complicated while-loops as possible, and just naming all the explicit operations that you might do using functions.

Of course, getting this right is hard, and this is usually where a lot of the complication in programming comes from. It turns out the real world is really hard to model, and basic operations tend to get more and more complicated, and don't really have obvious simplifications that we can make to them.

→ More replies (8)
→ More replies (2)

1

u/Vakieh Mar 06 '18

One type of diagram is the back end, one type is the front end.