views:

381

answers:

9

I suffer periodically from carpel tunnel (The "carps" as I shall affectionately call it). In an effort to extend my ability to do programming at least into my thirties (after which I'll have made my first million, obviously, so it won't be an issue any more), I have cut back on my out-of-work coding time, among other preventative solutions.

I believe in coding as a mental exercise, and as such I don't think that my physical limitations should hold me back (whether it's that my hand is hurting, or that I just don't happen to be near a computer or keyboard, maybe I'm just outside in the park). My goal is to be able to write code in my head, nowhere near a computer, and then turn what I did into real code later.

So I'm wondering if people have techniques that they use for this. In the past, I have kept a notebook in which I've brainstormed ideas about coding, though I haven't used that to write code directly. So I imagine that having the concepts on paper/in text is the end of the little process, and the question of how to represent the code on paper/in text/via schematics is less important/more easily solved than the problem of how to effectively visualize purely mental models of code. Suggestions?


Edit: As I said above, note that the core problem that I'm trying to solve is not my carpel tunnel (not here that is, there are other steps that I'm taking for that), but rather I'm trying to find ways to improve my keyboardless workflow as one of a number of workarounds for "the carps". :p


Edit 2: Just to be a little more clear, here are some examples cribbed from below that kinda get at the solutions I'm trying to brainstorm:

  • flow charts: e.g. I could attach visual images (chat functionality =
    talking heads) to concepts that I wanted to deal with and try to figure out how
    to make them fit together as code

  • UML: maybe if I get familiar enough
    with UML, I could start to think in
    UML.

  • Specs: Maybe I should ignore the question of code altogether and just think up detailed specs for the code and then leave pinning down the implementation for later.

  • Etc.

Anyway, food for thought, I guess.

A: 

First let me suggest you get the MS Ergo 4000 if you don't already have it! I can't code without it!

Sometimes I take a break from the keyboard and write code by hand for an hour or so. You have to type it in later, but I think the addition different type of wrist movement helps me, at least.

bobobobo
+6  A: 
  1. If your mouse hand is worse than your other hand, replace your mouse with something completely different.

  2. I recommend you purchase a Kinesis keyboard, or otherwise find an ergonomic keyboard which helps you. I personally have found the Kinesis to be therapeutic to my RSI.

  3. Consider Dragon Dictate or similar software. Much of this is programmable and it is important to get software which well allow you to select windows for input/switch applications and in general, avoid the mouse.

  4. If you do not know how to touch-type without moving your hands around as you type, learn how from a self-teaching manual.

The following is a visualization training technique. Go into a darkened room. Close your eyes. Watch the persistence-of-vision images fade inside your eyelids. Keep watching with your eyes closed. In a short amount of time, images will begin to appear. If you try to contemplate these images, they will dissipate, so it is better to focus the mental activity into observation of these images. After practicing this technique, visualization under conscious control will improve.

Otherwise, consider the diagrams from books such as Design Patterns and so forth. Such diagrams may spark your imagination.

Heath Hunnicutt
Switching your mouse hand will only make the other hand bad too (in time). I learned this the hard way.
plinth
Like most addicts, I'm pretty much aware of the things that I do that cause my problems, left hand keyboard shortcuts alt-tab, ctrl-w, ctrl-t, ctrl-s, ctrl-c, ctrl-x, and periodically the use of a laptop touchpad. That is a list of problems that I can solve (mouse gestures, deactivating keyboard shortcuts, changing the keyboard that I use, posture changes, breaks, etc). But it's already too late, because I have the pain. And I still want to code. So coding without typing is another one of the many approaches that I'm trying. It's something that I've always wanted to be able to do anyway.
Tchalvak
+6  A: 

UML. When I need to document architecture I use UML. When I'm thinking about architecture in my head, I'm imagining UML.

Matt Brunell
I've actually worked with UML in the past and found it kinda bland and under-representative, perhaps it makes more sense in a "just drawing or visualizing" context, though, because you don't have to jump through lots of hoops to get the right kind of arrow if you're just hand drawing it.
Tchalvak
+2  A: 

I would suggest just using what comes natural... psedocode, uml, flow charts, or whatever else will allow you to get the point out quickly without interrupting your flow, but also in such a manner that you can figure it out later when you come back to it.

cjstehno
+4  A: 

I contend that you already know how to "effectively visualize purely mental models of code" and it's simply a matter of getting some practice in. Most of what goes on when you're "programming" something actually happens in your head. Any artifacts external to your brain (drawings, UML, code etc) are simply putting it down so you can remember it later (or for the purpose of getting a computer to do it).

Most people need to do this very frequently (the goldfish), while some can keep multiple levels and layers of abstraction in mind for a very long time (the legends).

I think your real goal here should not be to have someone tell you how to do this in some way that works for them. It's possible they'll have useful methods and abstractions for doing so, but trying to turn yourself from a goldfish into a legend is going to be so connected to you and who you are and the way you think that it might be more beneficial to experiment.

Having said that, if you were me, this is what you'd do...

Start small...really small and visualize a solution to the problem. Sit in front of the keyboard but don't type anything. Think back to really simple problems (fizzbuzz and insertion sort type problems) and run through them in your head, without writing anything down. You'd start like this and get simple problems down. Move forward gradually to more complex problems and architectures...

Jason Punyon
Well, part of my problem is that, taking the php function get_defined_constants() and using that in code is so... ...keyboardish. It's all very word-oriented. So typing being a part of the process comes pretty naturally, even if I'm only typing intial comments or pseudo-code. Which I guess is a big argument for moving to diagramming. I do indeed have a process, couldn't have got this far without it, but it's a very word oriented process: Figure out what I want to code (a huge gloss over, that) Write it out in comments. Write the code around the comments. Which is fine, at a keyboard. :p
Tchalvak
A: 

About two years ago I could feel my hands starting to hurt after long sessions. I did two things to address the problem and I'm doing much better now:

  1. Got a "split" or "natural" keyboard. I absolutely hate these for typing when compared to a "normal" straight keyboard, but I have to acknowledge that it has helped me and you do get used to it eventually.

  2. Learn to use the keyboard shortcuts for the intellisense prompts in visual studio or a comparable IDE. Done right, this can save you a LOT of typing.

As an aside, normally I'd say this kind of thing isn't really programming-related as carpal tunnel isn't exclusive to programmers or programming. However, there are unique programming-specific challenges here. For example, identifier/variable names that won't pass spell checkers and don't work well with speech recognition software.

Joel Coehoorn
+3  A: 

I am 33 and have been coding/writing for many years now. A while into it I could tell that this was going to impact me in the same way that it impacted you. To get myself headed in the right direction I changed my tools and approach to coding. I code/write (I think they are the same from a skeletal point of view) from morning to morning (8am to 1-2am) nearly every day so I know that this approach works (at least for me!). This is a two part theory - tools and approach.

  1. Keyboard: Microsoft Natural Ergonomic 4000 - Once you get used to this you will find that your hands alignment with your arms is more realistic than the standard square keyboard. This to me is the best thing that I did for myself.
  2. Alt Keyboard: And if that doesn't work try the Data Hand - I have not yet tried this out...but I am going too. I will let you know how it works once I get mine. Not only is it better for the alignment of your wrist but it is also better from the point of view that your fingers don't have to move so far to get their job done.
  3. Mouse: Logitech Trackman - Another implement that you need to get used too but once you do you will never go back! A truely awesome mouse.
  4. Appropriate coding chair - Beyond your hands and wrist think about safeguarding your bum and back. I don't require an $800 chair...but spend at least $300. The difference is felt immediately.
  5. Lay back in your chair rather than trying to sit erect. This takes a lot of strain off of your back and removes the downward pressure on your lower back (puts some strain on your belly muscles which all of us programmers need anyhow...think continuous situp). Kick up your feet if you can.
  6. An assortment of squeeze balls - give your hands something else to do when you are not using them.
  7. Set your monitor at the right height. Your head is ok with swiveling from side to side (4 monitors?) as needed but is not ok with looking up or down for extended periods
  8. Good headphones - this way you can think about music or podcasts instead of your pain!
  9. Take some time to lift some free weights. This added strength training is not just good for your body but it really forces your hands to get stronger which means they will be less prone to pain from your day to day activities. I felt a huge improvmenet in my wrists and hands once I started lifting again!
Andrew Siemer
Weights at my desk are a good thought that I hadn't considered before.
Tchalvak
+1  A: 
  1. Don't try and code through it. Seek help. Start with some of Deborah Quilter's books. Next talk to a doctor and consider a specialist (perhaps even sports or music injury specialist). I offer these in this order because Quilter will help educate you so you know what to do with an ignorant doctor (first round ignorance is usually NSAIDs, splints and no education).
  2. I used Dragon Dictate/Naturally speaking. It's slow. I got really good at the international codes for letters (alpha, bravo, charlie, delta...)
  3. I swear by split keyboards and a properly adjusted chair, keyboard, mouse and monitor
  4. Hire a secretary. This was the most efficient way of getting code in place. I would fill 64 square feet of white board with code, call in my secretary and have him/her type in the code. I would then debug it with a voice system.
  5. Ignore points 2-4. Take the time to heal.
plinth
Right. I do want to just give myself downtime where I don't use my hands, to eliminate th' pain. But if I can code in mental ways as oppose to keyboard typing, then I can let my hands rest while still coding via visualizing the process and the like.
Tchalvak
When I say "that the time to heal" I mean it. It took you years to get this injury. It will take years to heal it. As to visualizing the process, I don't know how to teach you that other than to say that I do it all the time. I design code while I shower in the morning, while driving, while taking an afternoon walk.
plinth
A: 

This is probably a little too little, little too late, but I'm (nearly) 48 and still spend 4-6 hours a day on a keyboard, with no signs of carpal tunnel in sight. The thing I realized early on is that mice are evil. I've used laptops as my primary machines for nearly 20 years, and the great thing about a laptop is that the "mouse" is a trackpad (well, earlier, a trackball) that is very very close to where I am typing. Hence, my hand movements were always kept to a minimum.

On the rare days where I'm forced to use a mouse (at an internet cafe, or a client's machine), I really can't imagine how people get anything done with them, with all that extra wrist movement. How do y'all manage it?

Randal Schwartz