All in the <head>

– Ponderings & code by Drew McLellan –

– Live from The Internets since 2003 –

About

Mental Clarity

7 December 2004

For me, every project goes through a number of steps of mental clarity. The first step is coming to the code completely fresh and having to just read through it and grok how it all fits together and functions. After you’ve been doing that for a while, you have got your head around it all and it’s nice a clear. You understand how everything fits together, know how to best utilise the framework you have to write new code and make changes. This is the point where all the useful programming gets done.

Eventually this second stage comes to an end and you move onto the third stage of devastatingly complete and utter confusion. You end up holding so much in your head that there’s no room left to work with any of it, and you have to start paging stuff out to disk. Except you don’t have a disk. So instead you begin muttering $account_id, $account_id, $account_id under your breath in some vague hope that if your brain can’t hold it perhaps your mouth will. At this point a fixed glare and a facial expression somewhere between concentration and sheer terror helps.

By the time your mutterings have expanded into a primitive chant of variable names, object properties and loop positions, a rapid tapping of the foot is added to help keep it all together. The primary concern is momentum. Success is completely reliant on blindly pressing forward. It’s like that point in a egg and spoon race where your forward lean is moving you a little quicker than your legs can reliably propel you. It’s inevitable that you’re going to fall, but if you can just make it across the line first none of that matters. Must make it across the line. Must make it across the line.

And then you do. And it’s great. And the whole ordeal is worthwhile, despite the odd looks you’re now getting from across the office. I am a web developer. I may be insane, but I like it.

- Drew McLellan

Comments

  1. § Jason Stirk: My biggest problem – line numbers when you have to jump around the file. I always work with a sheet of paper devoted just to scribbling line numbers down to allow me to quickly jump from one spot to another in my code.

    Otherwise, people get a little confused when you turn to them and ask them to “remember the number 148 for me please”.
  2. § Peter Mount: I’d like to ask what would be a good resource for UML for web applications, either (preferably) a book or a web tutorial. We covered UML to a small degree in the Java class we did this year in the course I’m doing.

    It would certainly help my “mental clarity” if I learned to plan things a bit better than what I’m doing now

    Thanks
  3. § Jon Berg: It is all about modularisation and abstraction. I think the average person only can store and grasp no more than about 5 lines of code at any moment in the head. For me planning a whole program goes on a very high level. And then dealing with it on a top down approach. Extremely difficult parts of a program is often dealt with bottom up. I never wonder about what the variable names should be before coding it. UML worth using only for very large projects with more than 3 persons working on it. 3 or less will get by with a meeting doing some scribble on a paper. The more people you have inside a project the more time you spend on administration and the less on actual producing. The only reason for using a lot of people is when the amount of work is very large and the time is very limited. If you have plenty of time there is no need for many people.
  4. § Jonathan Snook: Jason: might I recommend an editor such as Ultraedit which lets you create a bookmark (CTRL-F2) on a particular line and then you can hop back to it at any time (F2). I use it SO often, it’s insane…for just the reason you mentioned.
  5. § Dysfunksional.Monkey: Ah, see, now you forgot the bit where every profanity imaginable passes your lips when that great piece of code you’ve just layed down, in that glorious moment when perfect clarity decends like a gift from the gods, doesn’t work because you missed a semi-colon and despite the error messages you can’t find where it needs to go…

    Or the bit where you’re working with recursive functions, and while muttering under your breath you’re making a looping motion with your hand and nodding randomly…

    Oh, and am I the only one who sticks his tongue out to varying directions depending on the size of the task? My boss introduced that little insight.
  6. § setmajer: Don’t do the tongue thing, but you can tell what sort of work I’m doing by the sort of music coming from my headphones:

    Techno (Alabama 3, Fluke, Crystal Method, etc.): early brainstorming, comping, noodling on architecture—the blue-sky creative kinda stuff

    Rock/Country/Blues (Steve Earle, Captain Paranoid, Izzy Straddlin, R.L. Burnside, the ‘Stones, etc.): churning through a spec, iterating a design across sub-page, markup, image optimisation—brainless bust-it-out kinda work

    Metal/hard punk (Motorhead, Iggy Pop, G’n’R, Cosmic Psychos, Zodiac Mindwarp and the Love Reaction, etc.): programming, stylesheet authoring

    Industrial (Ministry, KMFDM, ChemLab, Nitzer Ebb, Rammstein, etc.): debugging, problem-solving, x-browser testing

    No music: mental block

    I don’t typically choose the above consciously. I just put on whatever I feel like listening to. It just works out as above more often than not.
  7. § Dysfunksional.Monkey: Hey, i do that too, though I never realised it conciously. In place of techno I have downtempo, for rock its emo/punk, metal equates funky-house/dance, and finally blues/r&b for the rest.

    And I bet you’ve got an equivalent for the tongue thing.
  8. § Jesse: Classical music is they key to messing with your fellow office dwellers. When that is blaring on my old monsoons I get the funniest looks. It usually means I am reading through blogs and taking a moment to appreciate someone elses oddities and/or I have completely lost it and I am just staring out the window and/or I am bored with messing with the co-op student ;)
  9. § Bryan: The best moment of all is, by far, when a chunk of code you wrote in one go runs on the first try.

    Then you have to go back and figure out what the heck is going on so you can comment it. I often find myself looking at my own code and wondering just what the heck I was thinking.
  10. § Drew McLellan: Code that runs on the first try necessitates a Code Dance.

    This often involves some flailing of the arms and legs whilst spinning around on ones chair. In my experience.
  11. § Timothy Crowe: I develop for a college. My office, which I share with my boss, has the most bizarre behavior of any in the whole school. It seems that everytime someone of importance is passing by one of two types of music are on.

    1. loud metal with throaty screaming (Meshuggah, Nile, Lamb of God, Dimmu Borgir) coming from my computer

    2. really loud vulgar gangster rap coming from my bosses computer. Generally it is the part of whatever album that they are talking doing the dirty and there is a girl moaning really loudly.

    I also have a tendancy to give the screen the finger. And mutter threats under my breath. I make fake crying noises. I slouch way down in my chair almost to the point that I’m under the desk entirely with my arms and head the only things exposed.

    We use the Zope CMS at the college because our predecessor though it was great. I hate it. I hate python more. The other day we were trying to rip a python manual in half like strong man competition style.
  12. § Jason Stirk: Jonathan: Thanks for the tip, although I’m usually using Vim on a remote *nix server, which makes Windows editors a little tricky to use…

    Drew: Yay for the Code Dance!!

    Although it’s usually referred to as the ”$DEVNAME happy dance” in our neck of the woods – just watch the children run and hide!!!

    Personally, I can’t say I do the tounge bit, but will admit to making up silly songs and rhymes about bits of code, or other peoples Mums, or why I hate a particular function. (Depending on mood)

    For working music, some good chillout is my usual. Much like techno, but more ambient, a little slower and a little more relaxing.
  13. § John Wilger: Of course, as soon as you start using Rails (http://www.rubyonrails.org) for web development, this process becomes little more than a memory of the “bad old days”. Based on your variable examples, I’ll assume you currently use PHP. I myself am a recovering PHP programmer. Ruby blows PHP out of the water when it comes to anything more complex than a small, one-page script.
  14. § Drew McLellan: John – yes, PHP for production stuff at the moment. I’m brushing up on Rails in my downtime. It is very elegant indeed.
  15. § Dysfunksional.Monkey: Jason: You’ll be talking about downtempo (chillout). Check out epitonic.com and live365.com. They’re good resources.

    John: I’m a hard
  16. § Dysfunksional.Monkey: Oops. Thats what you get for multi-tasking. * blushes *

    What I meant to say was…
    John: I’m a hardened PHPer – could you point me to some good resources for Rails which might be able to compare the two?
  17. § Bryan: Alas, at the law firm in which I work for the Code Dance is frowned upon.
  18. § Jesse: Well it looks like at the mention of Ruby, my co-op student is off to do his work report comparing Ruby to PHP.. sheesh. Perhaps more code dancing in the near future.
  19. § Jason Stirk: John: I’ve been trying to find time to look at Ruby for a few months now. Alas, schedules are schedules and free time is rare. I’m currently working with PHP, and everything I hear about Ruby sounds to be good. (Not that I don’t like PHP – I do, but some of the effort you have to expend to make your code robust and secure tends to get a bit tiring.)

    Rails just makes it look even better. Thanks!
  20. § Mad: I’m so glad I’m not alone with the code dance. My tiny little development department is surrounded by the Marketing department and they look at us very strangely at times. The little dances of joy when something finally runs the mutter growls of “work you pice of s**t!” when something refuses too seem to worry them. Am I the only developer who looks at his own earlier code and thinks “My word that’s very clever, I have no idea what it does or how on earth I wrote it. In fact I don’t think I could do that again”?
  21. § Dysfunksional.Monkey: My bosses get very worried when I say to them, on a regular basis, “right, I’ve got it working now. I’m not sure how, though…”.

    I also remember a morning when I sat with my boss and churned out a very nice delivery costing system which worked on values and calculations stored within an .ini file. It was very complex, but just seemed to flow. My boss was a little confused by it all, but we continued and ended up with something which was very elegant and simple.

    Once we’d finished, I moved on to something else. About an hour later, he remembered another condition which needed to be implemented, so I sat with him again. We both sat there looking blankly at the screen, commenting on how well the code was written and how none of us could remember how it worked. It took me two hours to come to understand it again. This happened every time I came back to alter the code. Very annoying.

    Thankfully its complete.

    I hope.
  22. § Tim Uruski: Drew, those are my sentiments exactly.

    And also describe last Friday for me.
  23. § 下载: I usually have no matter to come up and see
  24. § Anthony: Drew…don’t change a thing!

    What people don’t seem to realise is the things we do are exactly what we should be doing.
    Ok, so we may sometimes come across ‘a revolution’ usually something you should have been doing a certain way a long time ago (if you were clever enough), but the codedance, the mumblings, the stumblings are all in human nature and one of the few things we have left.

    The witchdoctor had the idea, if you can convince those around you you’re in control maybe that belief will be enough!

Textile Help

Photographs

Work With Me

edgeofmyseat.com logo

At edgeofmyseat.com we build custom content management systems, ecommerce solutions and develop web apps.

Recent Links

Affiliation

  • Web Standards Project
  • Britpack
  • 24 ways

About Drew McLellan

Photo of Drew McLellan

Drew McLellan (@drewm) has been hacking on the web since around 1996 following an unfortunate incident with a margarine tub. Since then he’s spread himself between both front- and back-end development projects, and now is Director and Senior Web Developer at edgeofmyseat.com in Maidenhead, UK (GEO: 51.5217, -0.7177). Prior to this, Drew was a Web Developer for Yahoo!, and before that primarily worked as a technical lead within design and branding agencies for clients such as Nissan, Goodyear Dunlop, Siemens/Bosch, Cadburys, ICI Dulux and Virgin.net. Somewhere along the way, Drew managed to get himself embroiled with Dreamweaver and was made an early Macromedia Evangelist for that product. This lead to book deals, public appearances, fame, glory, and his eventual downfall.

Picking himself up again, Drew is now a strong advocate for best practises, and stood as Group Lead for The Web Standards Project 2006-08. He has had articles published by A List Apart, Adobe, and O’Reilly Media’s XML.com, mostly due to mistaken identity. Drew is a proponent of the lower-case semantic web, and is currently expending energies in the direction of the microformats movement, with particular interests in making parsers an off-the-shelf commodity and developing simple UI conventions. He writes here at all in the head and, with a little help from his friends, at 24 ways.