Why Programming Rituals Work
narramissic writes "Programmers may not think that their rituals are unusual, but if you swear that your code is less buggy if you recite it aloud or you prepare for coding by listening to certain music, don't be surprised if you get a couple sideways glances. In a recent ITworld article, Issac Kelly, Lead Developer at Servee.com, explains his routine and why it works: 'To me, programming is really the 'last mile' to getting something done. When I do the planning and specifications, I go on lots of walks, take lots of time with my wife, and really do as little work in front of the computer as possible. The more I plan (in my head, on paper, on a whiteboard) the less I program; and all of my rituals are to that end.' His ritual goes like this: 'Before sitting down to a coding session, he gets a big glass of water, takes everything off of his desk, and closes out all programs and e-mail, keeping open only his code editor. The office door is shut, and some sort of music is playing ('typically an instrumental only, like my 'Explosions in the Sky' pandora station,' says Kelly).'"
Before I undertake any task I do absolutely nothing. For about a day I will just idle around thinking about the problem. Kicking around one solution and another.... And I keep doing this until I am happy...
"You can't make a race horse of a pig"
"No," said Samuel, "but you can make very fast pig"
There's Slashdot. Even when I do everything else, Slashdot is the final work-preventer.
Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
1. Make a cup of coffee: Community New Orleans blend, one sugar, hazelnut creamer.
2. Read reddit.
3. Check social status sites: facebook, twitter, etc.
4. Read CNN.
5. Read email.
6. Catch up with coworkers.
7. Juggle a bit.
8. Put on headphones. Go to last.fm and hunt for a station that fits my current mood.
9. Check reddit again.
10. Go to lunch.
11. Read email.
12. Check reddit again.
13. Update to-do list.
14. Check icanhazcheezburger, etc.
15. Pick different last.fm station.
If you distill any of the accepted processes down then you plan first, even in agile processes. To summarize the summary: If you plan first and clear your workspace of distractions you do better work...
...when I make sure to release it when most of the testing group is on vacation. Vastly cuts down on the initial bug list, let me tell you.
The key to good software is contemplation. You can feel the social pressure at the workplace to be typing all the time, but it's wrong to give in. If they want someone who's banging on his keyboard all the time, let them hire a typist.
"It's too bad that stupidity isn't painful." - Anton LaVey
Sure, some of what the article talks about is a ritual, but the planning process isn't a ritual at all. Its a process. One that usually works pretty well, I must add. The less time you spend coding, the better your product is usually going to be. That said, knowing when to put down the whiteboard is sometimes important too.
I can fully understand using such rituals. It helps you get in the right head space for writing code. It gets you focused on the task and flush out all the other crap trying to get your attention.
I have found that if I am not in the right frame of mind before starting, the code takes much longer or is just plain wrong. If I am in the right head space, the task is quick and done before you know it.
"Trademarks are the heraldry of the new feudalism."
I get a cup of coffee, if that, and I sit my ass down and write some code. I don't go for walks, I don't spend quality time with the wife, I don't sit in the lotus position, I bang out thousands and thousands of lines of solid code. If there's a particularly nasty problem, I go to sleep and the solution shows up in the shower the next morning and then I code. Criminies. I blame "keyboarding" classes, "web design", and "object oriented methodologolologogies" on this sort of hippie chakra-based programming hooey.
It's a form of meditation, to put ones mind in a state that people call "the zone", where their creativity flows without obstacle.
Personally I find that code written in that state is hard to maintain. It sort of works, but it's rather badly structured. Coding "the hard way" may not be as fast and neither as pleasant, but it forces you to have a more rational approach to the problem at hand, and that results in better code.
The zone is perfect for rapid prototyping though.
I think the problem with planning everything too much is that you can't hold all the details in your mind at once, and sometimes your planned approach is not as good as one you come up with later given some time to stew on it (doing nothing).
I think programming is a very iterative process because it is symbolic and non-visual (i.e. not like building something with structures that are easily and intuitively able to grasp their structural and interconnected relationsihps)
Sweet, to see one of my fav bands mentioned on Slashdot of all places :-)
Crikey! That's just sensible work organisation. I guess if you find something that works and always do it that way you might call it a ritual. My ritual is to get in the car and go to work every morning... that way I can do, well you know... WORK!
I usually just stare at the code until it starts staring back; that's usually about when I realize that it's 6AM and I need to sleep.
~ C.
I think programming is a very iterative process because it is symbolic and non-visual (i.e. not like building something with structures that are easily and intuitively able to grasp their structural and interconnected relationsihps)
I have to disagree with you there, and I'll submit that you're doing it wrong if you're not visualizing what you're coding.
I'm a highly visual person, and as a result I'm really good at simplifying complex spaghetti written by people like you who can't see the obvious simple(r) solution.
If you can't visualize it, draw it on a white board. Remove any cyclic dependencies and minimize the number of connections. Visualize. Visualize. Visualize. Then code.
Coding is not an efficient way to hash out an idea. Mind mapping software is free, quick and simple to use, and frees your mind to get detail-oriented without losing track of anything.
Is something burning?
Oh, it's my karma.
I'm curious if other programmers like to code at night or any other particular times.
Here's a couple of long out-of-fashion words; contemplation and reflection.
There is no "process" -- not change requests, not planning documents, not maintenance windows, not design documents, and for damn sure no flavor-of-the-month buzzword -- that can replace someone with a brain thinking the problem through.
The problem with this is that it exposes the MBAs for the empty suits they are. Our "business team" -- salesmen with glorified titles -- sit through every meeting bloviating while the engineers get it done. The PMP certs are the worst about it. Me and a customer engineer will put our heads together about something, and decide on a course of action. The PMPs will jump all over it and send out emails about "deliverable actions items."
One of the other engineers will mention something, and we'll realize we should take a different approach. While we're getting real work done, the PMPs will barge in demanding to know if that action items has been deliverabled yet, and if not we need to reprioritize our skill sets.
I used to try to explain it to them. We were going to do that, but then we found out this, so were doing something different. I kept getting haughty responses about how they didn't need to know the little tech stuff, they were just managing the project.
One of them went on at huge length about how you didn't have to be a doctor to be a chief of staff at a hospital.
At that point I just began to feel sorry for him. Can you imagine living your life hoping and praying that no one will ever realize that you don't have the first clue about what you're talking about?
He put his boots up on the table and made a face. "The sig," he smirked. "You can waste your life in search of the sig."
I write firmware for a living, and I WISH I had a door to close. Nothing is more annoying or infuriating on my job than when coworkers are loudly shooting the bull while I'm trying to read a datasheet and figure out register settings.
"S.. TF.. U!"
I can code with some noise in the room, but I need QUIET when I'm reading a tech spec. I wish I had the ability to mask external stimuli.
sig: sauer
but the computer assholes from the company next door always scream at me to 'speed it up bitch im on my lunch break'
Oh, now *that* is funny. My comment about the articles redundancy is modded down for being redundant.
he gets a big glass of water, takes everything off
I stopped reading right there.
"When I do the planning and specifications, I go on lots of walks, take lots of time with my wife"
I enjoyed that comment, almost like we don't bother spending time with our wife's the other 90% of the time.
"During My Service In The United States Congress, I Took The Initiative In Creating The Internet." -Al Gore
My ritual consists of watching this and then killing a goat
the world is full of people with OCD.
You can run just as hard and fast as you like. Doesn't do you much good if it's in the wrong direction.
Deleted
I spent a good year of college programming only listening to X-Cops: You Have The Right To Remain Silent and Bloody Kisses.
Maybe it just replaced distracting noises with familiarity instead?
You never expect irony, do you?
Want to be a professional wrestler? Visit www.iyfwrestling.com
@iyfwrestling
I have a set of colored find point pens I use to draw out E.R. diagrams and then pseudocode on pads long before I sit at a keyboard.
The problem with quotes on the internet, is that nobody bothers to check their veracity. -- Abraham Lincoln
My only ritual is that if I find a bug or a problem that I can't resolve in less than 5 minutes I take a few hours off. After a while I get back to it and am usually able to resolve it without much trouble.
Don't link to the same story as the one you're posting on, don't have the same story open in multiple tabs, GET OUT OF YOUR INFINITE LOOP!
After the planning, thinking, doing nothing, etc. I think my ritual would be comparable to everyone else's. Put music player on random and slip on the headphones. Close ALL communications applications. Expand IDE across two monitors Turn off the blackberry Close the door Code away Then if anyone comes in and bothers me I give them dirty looks and short answers until they leave.
Now, let's have no more denigrating the practice of waving a dead chicken over the computer.
Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
I appease the Java gods by first sacrificing a virgin.
I have to disagree with you there, and I'll submit that you're doing it wrong if you're not visualizing what you're coding.
He isn't doing anything wrong, he just isn't a visual person, and coding isn't inherently visual.
I'm a highly visual person, and as a result I'm really good at simplifying complex spaghetti written by people like you who can't see the obvious simple(r) solution.
No, you can turn the code into a form where you can understand it better. It isn't necessarily simpler or better, just put in a different form. What you call "complex spaghetti" can be plain as day to people who think differently, and your "simplified" code can be as difficult for them to read as the "complex spaghetti" is to you.
No, you can turn the code into a form where you can understand it better. It isn't necessarily simpler or better, just put in a different form. What you call "complex spaghetti" can be plain as day to people who think differently, and your "simplified" code can be as difficult for them to read as the "complex spaghetti" is to you.
Sorry, but you're dead wrong. I can take code that not even the original developer(s) could understand and turn it into something easy enough for a PHB or QA dev to grok by skimming.
It's a fact that complex code is harder to maintain, and it has a higher bug density. There are plenty of tools out there to analyze the level of complexity in your code, and they all fully agree with me here.
Get some experience, kid.
Hell is other peoples code.
Visualize. Visualize. Visualize.
You could have done that with a loop.
This explains why Australians cannot write decent Java code, they can't find a virgin.
Over the last few years I've found that I can't write reports (i.e., those requiring full-English sentences) when listening to music with lyrics. I'm fine with some post-rock (Stars Of The Lid being a personal favourite), but if the song has words I get distracted very quickly. This doesn't seem to happen when writing codeâ"I can listen to whatever I want, and still perform well (at least by my standards). I'm not sure how to explain this, other than that my brain thinks in stepwise procedure, rather than sentences.
I am a messy individual at times. I can leave junk strewn around and know where everything is exactly. However, this seems to incur some computational or cognitive load ... I think it is probably a copout to avoid thinking about other things. Anyway, if I make my environment clear and uncluttered, screen too, then I am more relaxed and can think more clearly.
I should also say something here about Network Admins and the need to sacrifice chickens to the God of Problem Solving but it is probably obvious to all.
Bitter and proud of it.
That's true for some coding, peace and getting in to the zone with the meditation helps a lot.
But some coding, usually when working with other people code or debugging just required brute force beating your head against the monitor till bloody. I just can't to the Jolt, or now days Red Bull thing anymore.
I an getting too old for that sh*t.
That music isn't half bad,http://www.myspace.com/explosionsinthesky
I usually do old school electrofunk or techno, MIA, Philip Glass, Vangelis, Aphex Twins.
I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso
It's magic.
Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
From Beginner to Master, a Computer Programmer's Reading Course: So, you want to be a computer programmer?
I'm developing a course for aspiring computer programmers. I've been at it on and off for the past year. The reading list is done, the course outline and coverage isn't entirely done but is shaping up. This sounds like material that should be covered. Does anyone have a good writeup or recommended book for inclusion in the course? The Programmers Stone guys sort of cover this material.
You can see the course here:
From Beginner to Master A Computer Programmer's Reading Course So, you want to be a computer programmer?
It isn't true unless it makes you laugh, but you don't understand it until it makes you weep.
When you can prevent useless distractions, then you're really ready to go. Of course, I'm posting this on /., which shows me to be something of a hypocrite, but I think the point still a useful one.
I'm serious. I find that I solve many of my hardest problems in the shower. Now that I telecommute 100% of the time I'll often just take one, say in the middle of the afternoon, to jump start the solution!
Obviously the shower has nothing to do with the situation, it is the "stepping back" that is important, so find something that works for you, and do it.
You need to get into a state of mind to satisfy all those needs to communicate (program) to a computer, hence a ritual makes you "focus" yourself into that state of mind.
I saw a HARO request on this 11 days ago asking for, "Query:I'm looking for programmers who are willing to share any rituals or habits they have that help them code better -- whether by improving concentration or warding off buggy code or what have you. Email responses please."
That being said, not to dismiss the article, they were intentionally looking online for people that fit this category. Of course anything can be found online, and this leads toward a self-selecting population.
Just saying..
Tibbon
tibbon.com
programming rituals work because if they didn't they wouldn't be rituals, because people just wouldn't do them.
Blazing Spiders
Sorry, what? Been programming for a long time now, and by most measures I'm pretty good at it. And I have no idea what this "programming ritual" concept is - the closest I come is to put on music to fit my mood before starting, so as to drown out the background noise. but that's only if there's sufficient background noise to merit it...
I will do nothing for a whole day and just sit back, ponder ideas, relax to let my subconscious work out the logic.
This has always helped me put massive complex logic into complete perspective.
I can hold quite a bit in my head which allows me to do the programming very quickly.
Sometimes when I need to concentrate, I will require to work nights so I can have complete silence.
di.fm has helped a lot.
We really need an undo for moderation. Oh, well, I guess I can now post in this discussion.
I have determined that my sig is indeterminate.
stack overflow motherfucker! :^)
Simplifying code is also a good way to overcome 'writers block' In any large project there will always be a problem that has me stumped for a while...when this happens I like to go back over code I have already written and see if I can simplify it, and add comments that make it understandable to non programmers.
I thought it was the Department of Redundancy Department? Or is that someone else?
Sorry, but you're dead wrong. I can take code that not even the original developer(s) could understand and turn it into something easy enough for a PHB or QA dev to grok by skimming.
It's a fact that complex code is harder to maintain, and it has a higher bug density. There are plenty of tools out there to analyze the level of complexity in your code, and they all fully agree with me here.
Get some experience, kid.
Well, good for you then. However, you being a highly visual person and a good coder does not mean that visual people are better coders and non-visual people only produce complex spaghetti, or that visualization is an integral part of good coding (which seems to be your basic assumption).
I prefer to work with intuitive models. My "ritual" is as follows:
1. Ponder the problem. Not too hard. Just get a feel for how to solve it.
2. Prototype a solution in some readable language (python?).
3a. If the prototype is horribly broken, scrap it and go back to step 2.
3b. Otherwise, create final solution from lessons learned from prototyping.
A lot of people draw diagrams and flow charts and stuff. But that is stupid and too abstracted from the computer to be all that useful. By making a prototype, you're effectively making an interactive diagram/flowchart. It takes about the same time, and any problems will be immediately obvious.
GAAH! MY PRINTER IS ON FIRE!!! PUT IT OUT! PUT IT OUT!
I usually scratch my ass a few times, then boot DOS; launch edit and go wild.
Most of my code turned out like shit lately though.
There are developers who have offices?
That being said, I solve most of my difficult challenges while taking a dump. I can hammer on a difficult problem for several hours, then solve it in 2 minutes on the porcelain. There's something about getting away from the screen for a few minutes.
Whether it's realizing what is wrong with my approach, or coming up with an entirely new one, I do my best work inside my head. Actually getting the code into the file and debugging it is the easy part.
Managers: Don't bust your developers balls because they take frequent breaks.
Don't kid yourself. It's the size of the regexp AND how you use it that counts.
I've worked in software development for going on 15 years. I've never found an employer who realized giving developers rooms to themselves and a door would improve productivity. :P
Can't realize that something sucks when, in reality, it rocks.
I am not devoid of humor.
Years ago we had one of those bugs that was driving us around the bend, you all know how those are, so once when we were trying a fix, I started chanting "Praise Allah", for no other reason except for sheer desperation. And I kid you not, the fix worked on that very run.
Ever since then, we always remembered to praise Allah whenever we were struggling with a sticky problem. I live in Germany, so what we were actually saying was "lobet Allah", but over time we found that "Allahu Akhbar" works much better, especially when accompanied by gestures of supplication.
Occasionally we found that a difficult problem persisted for a while, until we realized that we had forgotten to praise Allah. After that, the issue was quickly resolved.
Don't try to give me some kind of egg-headed explanation for all this, this was just simply supernatural forces at work, that's all there is to it.
Always keep a sapphire in your mind
When I'm in the "thinking stage" (and that's the only thing I do before programming - none of this nonsense you see in the article) I spend some time when I'm taking a break to post on Slashdot (or some other message board, but Slashdot is best as the posts tend to be longer) and type as loud and fast as I can. The whole office thinks I'm working furiously and that they shouldn't interrupt me, then I can go back to thinking undisturbed.
If you sit far from the project manager/boss, bring a buckling-spring keyboard to work, those will cover a good 600ft. radius in a quiet office. Plus, if you get into an argument it will feel like you're using a heavy-caliber fully-automatic machine gun of words on your opponent.
"When information is power, privacy is freedom" - Jah-Wren Ryel
Sure, I "get" the rational answers about clearing your mind and letting your subconscious work on problems and stuff. Then there those other problems. When the network is down for no discernible reason. When it's a "bad day".
Here's a very weird bit of magic to know about. I know how weird this is, but it works. Oh, ye Gods, does it work! I have come to absolutely hate doing it, but, it just [dammit] works.
You won't believe it until you try it, and then you, too, will (a) hate it and (b) see it work.
Get Neil Young's "Live Rust" album. It's live, so studio engineers haven't fixed up all the mistakes.
Instead of hitting notes, Neil... shotguns notes, all around them. For some awful reason he writes songs on the very wobbling top edge of his vocal range. He's just one of those people who should be banned from singing the songs he writes.
The lyrics are really depressing. Cortez is massacring the Mayans. We got Mother Nature on the run. It's better to burn out than to fade away. And his favorite song topic, band people dying of overdoses: Every junkie's like a setting sun. Heard that he died, out on a mainline.
(Neil has not made a 2+2 = ? connection yet. If I were in his band and I had to listen to him every night, both (1) heroin and (2) death would look pretty good.)
I discovered this by accident while coding keyboard and mouse drivers. They were extremely hard. I was desperate. I saw one of those skiier T-shirts that says, "No Pain, No Gain", and I logically inverted it to "If Pain, Gain". I looked through my record albums to find True Pain and there was Neil. Put it on side 3 Repeat and started coding.
Six plus hours and 1,500 lines of 68000 assembly later, I was done coding. I finally ran the AS68 assembler on it, and it said back to me: 0 Errors.
YouHaveGotToBeKiddingMeTheresAlwaysErrors. TyposIfNothingElse.
Floating in a sea of shocked surprise, I linked it and ran it, and my God, the keyboard and mouse code worked the first time.
This does not happen. As Luke Skywalker put it, "That's Impossible!" I've been terrified to touch that code.
The Neil effect has continued to work.
Last time I used Neil was on a laptop that WinXP would not install onto. Tried 3 times, the install hung each time. The guy's son Anthony said, "Dave, why aren't you playing Neil Young?" Good point. I put it on. I explained this to the guy. He looked at me like I was insane. I said, "You don't believe it right now. That's okay. You'll see it. Then you'll believe." With Neil wailing away about his first cigarette, and changing absolutely nothing, the XP install went without a hitch.
All I can say is I tripped over it by accident, I don't know how it works, but damn!, it does work. And you'll start to dislike that album as much as I do. Maybe the cost is listening to something you really don't care for. (I should try rap!)
I'm not making this up.
-- Dave Small
It is by the fizz of Diet Cherry Coke that thoughts acquire speed, the lips acquire a stain the stain becomes a warning it is by will alone I set my mind in motion It is by will alone I set my mind in motion...
The best way to progress in real companies is to start on every assignment immediately without any thought or direction. Carry on until you get into a mess (which you will), then get another task assigned to you (by deniably pretending to management that you're done). Rince and repeat.
When management start asking for things to be finished, calmly explain what remains to be done without showing any guilt (you were being deniable earlier on, right)? Progress each one only when ordered to, in progressively smaller steps, like in zeno's paradox. Offer to keep track of the "status" of all your tasks.
You're delivering on everything that was asked for, so you look productive. You're managing your own stuff so you look like career material. Oh and soon enough your half-done rubbish will get passed down to junior staff as you gradually ascend into management.
I don't see where "thinking" fits into this. Seems quite irrelevent.
Seriously, though, geeks are half to blame for this - they forced engineering out of software development and now whine when subjected to management practices designed for airport bar tenders.
Doing diagrams and such might be stupid given your style, but there are those of us that think visually. (My initial college training was in architectural design where thinking visually is essential.)
When I'm working on something that is fairly complex, I sometimes resort to various graphic techniques for the really hairy parts. Nothing pretty or usable as documentation though.
I then convert it into pseudo-code as kind of a front end logic check. If the flow still works, I know I'm on he right track.
At this point it is a matter of coding and testing, after adding in all the boiler plate code needed to support the problem solving part.
Of course, there are also times when I go straight to the pseudo-code, skipping the visual design side of things. This happens when pondering the problem comes up with a variety of solutions.
I cried buckets when my old IBM keyboard finally died after having been schlepped all over the world for more than a decade and a half. I've been limping by on Microsoft Natural keyboard ever since. Where did you find an old honest-to-God-non-bubble-wrap keyboard?
He put his boots up on the table and made a face. "The sig," he smirked. "You can waste your life in search of the sig."
Why can't I be brilliant enough to make an awesome living by POSTING STICK FIGURES TO THE INTERNET?!
He put his boots up on the table and made a face. "The sig," he smirked. "You can waste your life in search of the sig."