
Code Like a Chef: Work Clean - gregorymichael
http://blog.baugues.com/code-like-a-chef-work-clean
======
gpcz
In similar articles referencing mise-en-place from a
business/programming/hacker context (such as
[http://thirdhandworks.com/2013/02/noted-mise-en-
place/](http://thirdhandworks.com/2013/02/noted-mise-en-place/) ), there is a
great quote from Anthony Bourdain's Kitchen Confidential:

“I worked with a chef who used to step behind the line to a dirty cook’s
station in the middle of the rush to explain why the offending cook was
falling behind. He’d press his palm down on the cutting board, which was
littered with peppercorns, spattered sauce, bits of parsley, bread crumbs and
the usual flotsam and jetsam that accumulates quickly on a station if not
constantly wiped away with a moist side towel. ‘You see this?’ he’d inquire,
raising his palm so that the cook could see the bits of dirt and scraps
sticking to his chef’s palm, ‘That’s what the inside of your head looks like
now. Work clean!‘”

------
tbrownaw
In contrast I put my laptop to sleep at the end of the day, and the next
morning I wake it up and have whatever I was in the middle of already open.
Often including what I was in the middle of a week ago when something with a
higher priority came up. And the lower-priority tasks I'm playing with
whenever my main task gets too monotonous.

But the actual code I'm working on? _That_ stays (relatively) clean.

 _Professionals realize that “quick and dirty” is an oxymoron. Dirty always
means slow!_

This depends on what timescale you're considering. If the way that was less
work in the long run was always also less work in the short run, technical
debt would not exist.

 _The cleanliness of a workspace is invariably reflected by the product made
in it._

This is why your autobuilder should be set to make a clean checkout every
time. It gets rid of any mess, so you know exactly what the inputs were that
got you your output.

 _How would you feel eating food from a filthy kitchen? How can clean code
come from a dirty desktop?_

Because your 20 open browser tabs are isolated from your email which is
isolated from your IDE. Food is a physical item which can pick up contaminants
from physical surfaces it comes in contact with. The code in your IDE is _not_
a physical item and does _not_ come in contact with your browser tabs. The
analogy doesn't work.

~~~
lifeisstillgood
I think we can all stretch an analogy too far - but if I may there are some
useful lessons - a commit is like plating up - it's the same food, the same
temperature, but instead of slopping it on the plate you make an effort to
present it well so the reviewer can easily grasp what's going on.

But you are right - professional chefs have so many things going on at so many
different stages of prep that it makes us coders look mono focused.

My favourite conference talk for a long time was at UK PyCon this year - where
the presenter wore a chefs outfit and discussed the important parts of
developers toolkit in an outrageeeeouuus Fraanch accaant - including a picture
of many small copper pans (ze sauce control).

------
ultimatedelman
while i appreciate the analogy, the final question irks me a bit: "how can
clean code come from a messy desktop?"

i've worked at places where the most brilliant, clean code comes from the
minds of veritable slobs. i'm sure the "clean, organized" approach works for
many, and it is definitely a good mantra to live by, but to assume that it's
the only way to achieve good clean code is a bit arrogant.

~~~
joe_the_user
Yes,

I have no problem with learning _an_ idea which might for someone and so might
work for me.

But whenever some approach of this sort gets currency, it has the danger of
going from a useful idea to use if you like to a stricture managers repeat
useless.

I would hazard to say coding is different from cooking or woodworking in that
the coder has to draw from many more sources and leaves many more open loops
(And I actually cook and code professionally, oddly enough).

------
pedalpete
This is why I'm creating a new IDE, one that allows you to focus on the tasks
that are actually part of your coding in a clean and unobtrusive way.

This post makes me think I'm on the right path.

~~~
terabytest
How does your IDE solve this? What does it do that other IDEs don't? Keep in
mind that usually IDEs are distractions themselves. Most of the times you can
code with Sublime Text and a terminal window open.

~~~
jimmaswell
I've never found an IDE a distraction. Visual Studio Pro has saved me tons of
time. Coding in a terminal editor can feel a little suffocating in comparison.
In VS I almost never have to look up syntax, with good OO the autocomplete
almost makes the code feel like it's writing itself, and all the project's
files are in an organized spot on the right instead of having to trawl through
directory listings.

------
tel
I find it a little off point that he focuses on the desktop not the structure
of the code itself. My desktop remains clean (it's part of why I am never a
fan of huge monitors, actually) but the real clutter is in the mental model
and abstractions littered about in the code itself. That's where my mise en
place happens.

~~~
gregorymichael
That's a great point too. I focused on the environment around the creation
because, while a I read a lot about writing clean code, I had never had anyone
outside of the kitchen teach me about how helpful it is to have a clean
workspace.

------
jayhuang
As someone who is regularly working on 2 or 3 different projects at any given
time, de-cluttering has been incredibly helpful with my productivity.
Especially when I'm on my laptop.

Every additional program I have open is a potential distraction. Every single
one of the 20+ tabs I have open is a potential distraction. When I'm on my
desktop, I can afford a bit of that. I can move some distractions to the
monitor on the right and place it behind something else. But I still make a
conscious effort to cleanup my workspace regularly.

I didn't think those extra open tabs had an effect on me, but they do. They're
a constant reminder of the many things I have yet to work on, and the
significant impact they (can) have on my life and family. Removing those tabs
and windows to focus only on the task at hand has been tremendous in helping
me with my constant state of anxiety.

~~~
Theodores
Multiple virtual desktops, my friend.

If clients pop by and want to see how you are doing on their project then swap
to the required desktop and every terminal window and every browser tab
relates to their project and nothing else.

You can also have a desktop with your own stuff on it, i.e. with all the
distractions, and not have to fret about closing it all down. Pick up with
your distractions where you left off.

When you are done fixing whatever for project whatever you can simply close
down the browser and terminal windows on that desktop, you don't have to sift
through your tabs.

If you do need to change focus from project A to project B then it is a simple
switch, not a mess to wade through.

------
CraigJPerry
I always like finding new tools to help with this kind of thing. [awesome
window manager]([http://awesome.naquadah.org/](http://awesome.naquadah.org/))
- coupled with vim window splits and tmux can work pretty well.

On mac spaces with full screen apps and the 4 finger swipe gestures work well.
Feels awkward on medium or large screens though.

Since i switched full time to GNOME again, i've been trialling this [auto move
windows extension]( [https://extensions.gnome.org/extension/16/auto-move-
windows/](https://extensions.gnome.org/extension/16/auto-move-windows/)).
Seems to be working quite well so far.

------
avelis
I can not stress enough how much lift I gained from reading Clean Code and
Clean Coder by Robert C. Martin. If it was one set of books I wish I had fresh
out of college these would be it.

~~~
gregorymichael
Same here. Clean Coder taught me what it means to be a professional programmer
as opposed to a guy who programs.

------
jweir
There is a good scene in Pixar's Ratatouille about keeping your station clean.
Thomas Keller was a consultant for the film.

I once read that Japanese construction sites would sweep up, clean their tools
and put all them away at the end of the day. I don't know if it is true or
not. But it got me to shutdown all my apps at the end of the day.

My editor is never left open. I shutdown my VMs. Then in the morning I start
fresh and clean.

