6 ms·
Code Like a Chef: Work Clean
- ultimatedelman 13y agowhile 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.
- gregorymichael 13y agoAuthor here. I agree with you.
- avelis 13y agoI see your point. Unfortunately, we are taking a subjective term and applying it literally by one's interpretation of the word 'messy'. A subjective term is hard to measure objectively.
- joe_the_user 13y agoYes, 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).
- ernestipark 13y agoI think "clean, organized" is more about what is in your head. For the author, a clean desktop helps him keep thoughts and ideas clean and organized. I totally agree in that I've seen some ridiculous slobs come up with brilliant code and ideas - but their thought process is always clear, focused, and organized. To use a nerdy analogy used at work sometimes, our brains have a limited stack size and having to figure out where a file is, what tab to search for, etc, can take up valuable stack spaces. But for some, being organized can help keep that stack clean of everything except what is essential for what you to do your job. I'm similar to the author in that using a window manager, killing all my chrome tabs periodically, and writing down meticulous notes in Evernote help keep me organized and focused on the task at hand, but obviously this will look different for different programmers.
- tel 13y agoI 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 13y agoThat'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.
- pedalpete 13y agoThis 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 13y agoHow 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 13y agoI'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.
- pedalpete 13y agoI completely agree with you, and find most IDEs too complicated for the task at hand. Sublime Text is great, but I , like you, find I have other tasks running in terminal windows (normally at least two), plus a browser window. I feel like IDEs have forgotten that the first letter stands for 'Integrated' as they leave us jumping around from one place to another. My goal is a simpler interface to improve the focus on the task at hand. Maybe not as minimalist as Light Table, but easier to use than the IDEs I've seen. Just started coding, so a long way to go.
- strictfp 13y agoI trust that you are aware of Mylyn?
- pedalpete 13y agoI wasn't aware of Mylyn, just took a look at this video http://www.youtube.com/watch?v=IEyjpDrHCjc http://www.youtube.com/watch?v=IEyjpDrHCjc, look at all that STUFF! What does this do? Who can figure it out? I think an IDE should be as simple as a text editor, with the tools you use most to get the job done.
- jayhuang 13y agoAs 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 13y agoMultiple 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.
- avelis 13y agoI 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 13y agoSame here. Clean Coder taught me what it means to be a professional programmer as opposed to a guy who programs.
- CraigJPerry 13y agoI 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.
- gpcz 13y agoIn 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!‘”
- jweir 13y agoThere 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.
- tbrownaw 13y agoIn 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 13y agoI 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).