Slashdot Log In
Overcomming Programmer's Block?
Posted by
Cliff
on Tue Aug 01, 2000 06:23 AM
from the regaining-your-focus dept.
from the regaining-your-focus dept.
goingware asks: "What do you do if your productivity drops to two lines of code a day, and you just sit and stare at the code and feel like you don't know how to do it anymore? On the outside, it would seem my problem is that I've got some difficult architectural issues that I'm wrangling with. I'm not sure what the right way is to approach a certain feature I'm building into my program in C++. But what my real problem is that I just sit and stare at the computer all day long feeling scared and anxious. I'm afraid to try anything out at all for fear of making a mistake. I know I could just back up the code and write any old thing and throw it away if it's wrong, but for some reason knowing that doesn't help." What do you do when you are stuck in code and your focus leaves you? This isn't something as easy as getting up from the problem for a while (although that helps), this is sounds like something closer to burn-out. What can programmers do to combat this?
"I've encountered this before, but it's not normally like me. I've been programming as a career for something like 13 years now and shipped dozens of products. I've had many obstacles before and overcome them through many and various means... means which all escape now.
Right now I feel like a clueless newbie assigned the task of re-architecting a nuclear powerplant control system.
This has really got me down. I have a product to ship. I called my client and asked to take a few days off from coding, and told her I'd be hitting the C++ books and taking a rest and trying to rejuvenate my programming creativity. She was OK with this. So part of that process is posting my question here."
This discussion has been archived.
No new comments can be posted.
Overcomming the Programmer's Block?
|
Log In/Create an Account
| Top
| 403 comments
(Spill at 50!) | Index Only
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Re:The Author Speaks (Score:3)
Here's what I did (an extreme case) (Score:3)
I studied the system for quite some time trying to get around it, and finally concluded that I'd hit my limitation as a programmer. I just couldn't make the leap to the different programming style that was needed. I resigned the contract, gave a good deal of the money back, and wound up going into networking instead. Since then, I've written only a handful of code - a couple of HyperCard apps when that first came out for fun, and a few shell scripts and Perl hacks to automate stuff. And one more "for pay" coding job - a script app written in the old Mac White Knight comm language to automate file transters for a doctor I knew. That's it.
Needless to say, I hope that most people do not follow my example! I lucked out and was able to pick up another skill (that I turned out to be better at), when I ran into my programming limits.
Because even then I wasn't a very good coder...
- -Josh Turiel
Some thoughts for when the crisis hits (Score:5)
If the problem still looks bad when I get back to it, then the next thing I do is ask a colleague for advice. In situations where there isn't another programmer around, I simply describe the problem to any willing listener. Often the simple act of talking about a problem elucidates the solution. Now this is going to sound silly, but I've even talked to my cat when working at home and sometimes had that "eureka" moment.
If the task is simply beyond your ability, then it's time to admit it - approach your manager and say so. Grit your teeth and accept that no proprammer can do everything. Just hope that your boss understands that. If you lied about your abilities to get the job, then I've no sympathy for you (having fixed cock-ups by such people). Otherwise, if your boss is able to do his job properly, then he should be able to see this is a resource issue - not a general failing in yourself.
I've actually quit a job because I felt the task I got given was beyond my abilities - finding some comfort in the fact that programmers are a scarce resource. While it is a drastic course of action, I felt almost europhic knowing the stress was over. So if it's not just burn-out consider getting out of the job.
Chris
Tricky but effective (Score:4)
This is not exactly how I do things at my work, but there have been ocassion where I have introduced code of my own into the knowledge base of work. (don't worry, I have a clause in my contract which states the company and I will share intellectual property so I won't lose a damn thing)
stop staring at the screen (Score:5)
Stop thinking in C++. Start with the big picture. Map out the problem. Then drill down to the architecture. Then drill down to the core functions of each module. Then firm up your data/object models. Next, drill down to the detailed design. Most of this should be boxes, arrows and lines, not code.
Then, and only then, start doing serious real coding. If you wing it, you're liable to get stuck or produce something pretty unwieldy.
Re:Pray (Score:4)
In my case, I find that a lesser banishing ritual of the pentagram helps.
Mutatis mutandis for your own faith.
The Tyrrany Begins.... [fearbush.com]
so true (Score:4)
So, when I built my box for home, I had them install a nice ethernet card for my little LAN, but I kept the modem out. And the difference is pretty amazing. Just dis-engaging my mind from the computer, going outside and thinking about problems without the computer staring back at me is quite refreshing and helps my creativity immensely. The computer is just a tool, after all, and sometimes one needs to put aside the tools to get a better look at the problem.
Re:The Author Speaks (Score:3)
That is what you do to overcome a programmer's block. get a life.
Can you blame him? (Score:4)
When atheism is oppressed (as it has been through most of history, and still is in much of the world), practical atheists give lip-service to religion. When speaking other words, or even remaining silent, would likely be punished, one's words are no evidence of anything at all.
BTW, Newton was a remarkably ruthless and pragmatic person who is known, as a matter of historical record, to have told lies often, and about many things, for his own benefit.
---
Despite rumors to the contrary, I am not a turnip.
Try some basics - works for me... (Score:3)
I find this method helps a lot: you can produce a small elegant system which works. It's like "wow - this is really elegant and I coded it." It seems to switch your programming circuits on but leaves the blockers off. The result is you realise you *can* program after all and you'll have probably learned something in the process - maybe a deeper understanding of the algorithm or a faster way to do things. The brain is pretty good at self-organising which means any knowledge you gain doing this could well help you with a stumbling block elsewhere i.e. you're not wasting time on a trivial exercise...
coder's block (Score:5)
Finding myself unable to code, I started writing the code in english on paper. I would sit down in a corner of the room and start writing in english. "check the user permissions. if the guy is an admin, show this and that screen. for each line in the screen, make sure it's bla bla." and so on. Once I was done and saw that I had something that could work, I took the text, pasted it into the existing source code and started translating it to code (Java in this case). Maybe it won't work for everyone, but it did wonders for me and I was able to overcome my block several times this way.
patterns, not flowcharts (Score:3)
At the implementation level, object-oriented code and flowcharts don't mix well. Most of us find little value in hundreds of flowcharts consisting of (start)->(call super)->(one line of additional code)->(return). Something like Z notation (to describe the object and the various operations on it), on the other hand....
At the detailed design level, almost all problems break down into one of 500-1000 lower-level patterns. E.g., "this is how you recursively descend a directory tree." While you could use flowcharts, I (and many others) find it better to use canonical "null" examples. The work breaks down to verifying the common stuff is the same and our extensions do what we want. (See also earlier OO comment.)
At the design level, "patterns" work best. At that level the focus isn't on *how* the code is put together, it's on *what* each block of code is supposed to do.
So what's left? Flowcharts at the architectural level? I don't think so. (This level should have DTDs, though!)
Re:The Author Speaks (Score:3)
Seriously you dont have to get away from computers just away from programming in all of it's forms. You can surf the 'net, read
As for your second suggestion, why not boast? Coders just get made fun of in the "real" world. Why not let someone know exactaly how important what you are doing is.
And if you find some girl who will actually listen to you while you are boasting: Marry her. I'm not kidding about that.
Devil Ducky
ZATAOMM's take on "stuckness" (Score:4)
So I think you did the right thing by riding it out, reviewing fundamentals, letting the solution present itself to you of its own accord.
If you think of writer's block as a boulder in your path, you can extend the metaphor to how you go about destroying it: You can either flail away at it with a sledgehammer, expending enormous energy to make slow, painful progress; or you can study the rock, learn it, find the cracks, insert the chisel and destroy it with two or three taps. It is rather Zen. When you are not actively typing away at a problem, you are gaining awareness of its true nature.
So use your time of stuckness to do good things, and if you work where your manager says things like "I didn't hire you to think, I hired you to work", buy him a copy of Demarco and Lister's Peopleware [amazon.com] and tell him to go away and come back when he's read it.
Note: The above links to Amazon.com do not imply endorsement of them. Support your community's independent bookstores: read Amazon's reviews of these books, then purchase them locally.
--
Actually, exercise really helps... (Score:5)
Endorphines and what not, I guess... Plus it helps get your body tired so you can get longer, more restful periods of sleep. They've done lots of research showing heavy exercise can overcome some mental problems like ADD, and that is the same mindset I end up in when I feel blocked...
Best of luck.
Programmer's block (Score:5)
Don't be afraid to fail.
Sometimes, the problem definition is too vague, or there are too many unknowns in the mix. You have to follow the scientific method, and the first step of the scientific method is gather data.
You have a module that you cannot figure out how to do? cvs commit, then say to yourself, "Self, we're going to write something to see what is what. When we are done, we will delete what we have written, and using what we've learned, write it properly". You'll be amazed at how much clearer the hidden requirements become when you start bashing code against them.
Now, as to the C++ issue: I don't know if part of the problem is your level of skill in C++, or if that is just a red herring. If you really aren't comfortable using OOD, then for Torvalds' sake DON'T! Just write the code proceedurally. Again, I've often found that once I've written a code block, I can then better see where the objects are within the code. Then, I re-write the code to be OO.
In my experience, no object is reusable from the beginning, no matter how much work you put into it, no matter how long you worked on the design. Only after the third time a class has been used have you come close enough to defining what functions need to be virtual, what members non-private, what args need to be passed to the constructor, etc., to make the class really reusable. Accept it and move on.
Like I said, don't be afraid to fail. It's the only way you will succeed.
Become a Manager? (Score:4)
Bail out - become a manager - it's worked for so many others - how can it be wrong?
But seriously:
In one place I worked at, we had a standing rule - if you were bogged down, it was better to just pack up and go home for the day. Get out, get some R&R and get back tomorrow to resolve the issue.
This came about mostly 'cos I had a couple of occasions where, after pounding at a problem until late at night, I'd give up and go home. I'd be half way home when I'd realise what I'd done wrong and, turning around, would race back to plow through the issue.
So, it was not uncommon to hear a defiant "SCREW THIS AND THE HORSE THAT CRAPPED IT!" from the development area followed shortly after by a resolute programmer storming out of the office. Usually within an hour the person would be back with a solution.
Worked almost every time...
Re:The Author Speaks (Score:3)
Suggestions:
1) Develop some hobbies or other interests that have nothing to do with computers or books or other mental activity. Preferably, some physical sport that causes you to sweat a little, or something like carpentry . Spend at least 30 minutes a day on such activity. A healthy mind requires a sound body to stay healthy.
2) Hang out with some non-programmers of the opposite sex once in a while. Tell them about what you are doing (in a non-boasting way). Never underestimate the effect of the power of "wanting to show off" on your creativity.
Hari.
"I must not fear." (Score:5)
But you probably already know that. And I already know the cruelty of simply telling someone not to fear. I'm no programmer, but your problem is universal.
You are finding it difficult to work. This is because, as you perceive it, the risks of continuing outweigh the benefits. You may explicitly tell yourself that this is not so ("I know I could just back up the code and write any old thing and throw it away if it's wrong"), but the horde of automatic thoughts that rise up when you contemplate doing it say different. You know that in a long-term sense, bearing down and getting through the work is the best thing by far. But when an individual's fears of failure become strong enough, it can force hir out of the long-term perspective and into a low-level, immediate world, the same way that you can be stopped from contemplating Rodin's Age of Bronze by a splinter. This is the point where you might just be told to shut up and work through it, but another way is to figure out what your fears are, whether they're reasonable, and whether they can be disproved or transformed.
If you were trapped in a situation where the alternatives were painful, awful failure and procrastination, your solution would be to procrastinate. You must acknowledge that this is reasonable. The first step is not to blame or criticize yourself, which only increases your paralysis, but to compassionately accept that you're in a bad situation and start working to get a handle on it. It sounds like you're already on that road.
Now, we have to find out why you're fearful and emotional about this project and whether it makes sense to be that way. The simplest of all tools in my field of study is the double-column technique. Just think about the automatic thoughts that go through your mind when you contemplate working, and get them written down on the left-hand side of a sheet of paper.
I don't know what your thoughts are, but for many people they may look like this:These are frightening. Are they true? In fact, they contain cognitive distortions that all people make to some extent. The second and third show the especially insidious error of dichotomous thinking, the tendency to see things in an all-or-nothing sense. A single failure could be due to a specific hole in your education, emotional factors outside your work, a lingering virus, or all sorts of things. But even if you completely and utterly screwed up, would that erase thirteen years of success? Surely that makes no sense!
On the right-hand side of the sheet, write the best refutations you can think of to these statements. They should be compassionate, insightful, and constructive -- everything you'd tell a friend in your situation. In this example, they might be:Keep your refutations with you at all times, and write them down as you think of new ones, or notice new automatic thoughts. What you have to do is take the most powerful and frightening thoughts you can uncover and argue them down. I mean seriously argue, bringing up the best refutations you can and trying to believe them wholeheartedly. Even if you don't buy them now, think how much more productive they can make you. This isn't really dishonest; if this rational optimism leads to repeated failure, you can always re-evaluate it and change to thinking you're a washout.
Fear and self-criticism are terrible motivators. Relaxed understanding allows you to work with an absorbed sense of flow. To put it tersely:
chill.
- Michael Cohn
Important note: I am a student, not a licensed or degree-holding psychologist. I am giving you a digest of other researchers and writers. This may be valid self-help advice but should not be relied upon for severe or life-threatening problems
Recommended reading on the subject of Cognitive-Behavioral Therapy:
Beck, Judith: Cognitive Therapy, Basics and Beyond -- a textbook. Dry but comprehensible.
Burns, David: Feeling Good -- a self-help classic. Burns is a moron about a lot of things, but it's overflowing with useful techniques and arguments.
Ellis, Albert: A New Guide to Rational Living -- If you're sick of therapists who act like Deanna Troi, you'll be pleased when Ellis comes and kicks you in the ass.
Caffeine: the wrong tool for the job (Score:4)
One means of stirring up the creative juices is to walk far away from the computer and pick up a good magazine (like Scientific American) with articles from a wide variety of backgrounds. It can be useful if you're an engineer, for example, to read articles from biologists or astronomers to give your brain a kick in a different direction...
Tell someone who doesn't care (Score:3)
Didn't matter, though, because by talking it out I always talked myself into an answer. I'd say "That'll work. Thanks!" and go back to my desk with them staring at my back, puzzled (and probably frightened).
You could always try a bigger change (Score:4)
I changed everything about working with computers.
For years I used to specialise in programming VB and Delphi apps in Windows (don't laugh, it paid the bills), and I was really in a rut. I had tried just about everything using those languages, and there was no very much left to interest me.
So I made a big jump. I switched to Perl. I got a new job programming in Perl as a trainee consultant, and after 6 months solid learning, I still realise that I am only scratching the surface.
Life couldn't be better. I'm having challenges again (I also switched from Windows/IIS to Linux/Apache), there is lots to learn, and the fun that I used to have when I was playing around with my old ZX81 has returned. Coding is great again.
CAFFEINE is EVIL (Score:5)
Caffeine is EVIL
No, really.
It might seem like the problem is a particularly tricky algorithm to implement, or a bug that you can't track down, but this is never, ever, really the case.
The problem is Stress, and if you (I'm more addressing this to the clueless replies than the original poster) don't admit that and deal with it, it will just get worse.
A charge of Caffeine won't prep you to handle tougher problems, it will just make things feel even more hopeless and impossible. If there is any wonder-drink that will sort you out, it's a Smoothie, made from fresh fruit, that contains lots of de-stressing anti-oxidants and natural sugars.
Another wierd viewpoint I've seen in this discussion is that when you get burn-out, you should take a couple of days off and then dive right back in. DUH! Why not adopt a lifestyle you can maintain indefinitely??
Through my degree I tried all sorts of things that I thought would directly increase my productivity - Coke, ProPlus, Guarana - and they all just served to make me more stressed, depressed and non-productive.
What really increases productivity is having a rest and doing something different. I always try to:
Do something small at least every hour
- Go to the toilet
- Go fetch a smoothie
- Go and have a chat to someone
- Pray (I ain't religious, but I see that this would help) or meditate
Do something longer two or three times a day- Lunch OUT of the office
- A walk in the sunshine
- Watch a movie
- Have sex (on your own is just fine)
- Play an instrument
- Have Exercise (trust me, there IS a worthwhile sport for you, even if it's just a walk in the park)
Take the weekend off- Veg
- Tidy the house
- Dig the garden
- Go visiting people
Duh, people tell geeks to get a life. Sometimes we don't even look after the one we've got.Re:Superstitian as an answer to science (Score:3)
It takes far more imagination to pray than it does to regurgitate these vanilla pseudo-scientific opinions on religion.
And, scientifically speaking, your belief in the "subconscious mind" solving your problems is just as superstitious as anyone's belief in a deity.
Programmer Block (Score:4)
For me its all about momentum. The more I code the more I want to code. If I have to keep shifting gears, by attending meetings, writing reports, etc I can't shift my brain into gear. Then I am left in limbo, usually checking my email every couple of minutes and making sure slashdot hasn't posted a new story.
Fortunately for me I work at home, so I can avoid most distractions, but it usually takes me at least a day to recover from a day in the real office.
just my $.02
-MS2K
Re:coder's block (Score:4)
Umm, I think that's called pseudocode, dude. You're supposed to write that before you start coding. At least, that's why I keep being told ;)
Get Offline :) (Score:3)
Now i do soo little