Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a hobbyist programmer and a beginner. Most of the time, I cannot solve the problem while sitting in front of the computer. For example, I was trying to find out if one number is a power of another. I couldn't figure out the solution until I grabbed a pen and a paper then analyzed the problem. In roughly 3 minutes I solved it and wrote the script in Python.

Sometimes I can solve the problem while sitting in front of a computer, but with some struggle. Is that ok?

share|improve this question

closed as off-topic by Ixrec, Snowman, Andres F., gnat, Bart van Ingen Schenau Mar 12 at 8:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking career or education advice are off topic on Programmers. They are only meaningful to the asker and do not generate lasting value for the broader programming community. Furthermore, in most cases, any answer is going to be a subjective opinion that may not take into account all the nuances of a (your) particular circumstance." – Ixrec, Snowman, Bart van Ingen Schenau
If this question can be reworded to fit the rules in the help center, please edit the question.

5  
To me this isn't too bad of an issue, and in fact plenty of people stare at the computer too much, eventually not realizing they have this issue to a lesser extent. Lots of professional programming is going to involve very rote changes instead of the tricky logical formulas usually given as homework assignments, and it's not so much of an issue if you can at least accomplish those. – Katana314 Mar 11 at 22:25
2  
I think you might just want to reword your question so that it makes more sense about programming. – StevieV Mar 11 at 22:30
6  
This is completely subjective. Everyone learns and works differently. Do what works for you. – Snowman Mar 11 at 22:32
6  
In front of the computer can be the worst place to try to solve a problem, because you get too tempted to start typing when you should be thinking. Often getting way from the machine is better because it forces you to think not act. Most of my most difficult problems have been solved walking to the office in the morning. – Steven Burnap Mar 11 at 22:50
2  
Also there's the question of just how difficult the problem is. As you gain more experience, some problems that are difficult now will become easy. But that just means that you get to solve even more difficult ones. For myself, I solve a lot of my really difficult ones while hiking or cross-country skiing. – jamesqf Mar 12 at 3:31
up vote 33 down vote accepted

I tend to solve my most difficult problems:

  • In front of a whiteboard (sometimes without even drawing anything - just thinking about how to visualize a problem can sometimes lead to a solution)
  • While explaining them to colleagues
  • Looking out of the window
  • While taking a walk
  • Under the shower
  • On the toilet

Going away from the monitor is often very helpful for concentrating on the problem itself and not just on typing out an implementation.

The problem solving happens in your head. Typing in the program code is just how you explain your solution to the computer.

share|improve this answer
1  
Thank you! You are right, the more I am away from a computer, the more I can focus on the problem. – Mahmud Muhammad Naguib Mar 11 at 22:49
2  
I remember reading a book (can't remember which, unfortunately) that suggested keeping a rubber duck at your desk, and when you are stumped, describe the problem out loud to the rubber duck. – Steven Burnap Mar 11 at 23:24
7  
@StevenBurnap This is called rubber duck debugging and you likely read about it in The Pragmatic Programmer by Addison Wesley. – Philipp Mar 11 at 23:45
2  
"Typing in the program code is just how you explain your solution to the computer." – Alan Perlis said: "Programs should be written for humans to read and only incidentally for machines to execute." I would rather look at this way: typing in the code is just how you explain your solution to your colleagues. The fact that once you describe the solution un-ambiguously in such a way that any human (including yourself, 6 months from now) can understand it, it also becomes executable by a machine, is just a side-effect of it being described rigorously enough that there are no ambiguities. … – Jörg W Mittag Mar 12 at 1:00
4  
Re: rubber ducking. There's also a similar story with a teddy bear. Tutors at MIT used to sit teddy bears outside their offices. You were only allowed to knock after having explained your problem to the bear. Half of the students never knocked on the door, having figured out their problem while explaining it to the bear. Formulating a well-written, well-researched, well-formatted, detailed, high-quality question on StackExchange can have the same effect, which is (one of the reasons) why we're so anal about doing just that! – Jörg W Mittag Mar 12 at 1:19

I think that this is a good question. From how I interpret this, what I think you are asking is, "Is it okay that I periodically have to step away from the computer"?

I do not think that there is a day that goes by where I don't have to get up and ask somebody else what they think, or pull out a piece of scratch paper and scribble down an equation to work out the problem. Also, when you get more into programming, you will not might not even start writing the code until you have created a diagram/architecture beforehand.

I was taking a data structures course when I was in college, and was having trouble designing a sorting algorithm. When I asked my professor for some help, he knew that I hadn't thought about the problem beforehand. The first thing he told me was that I was not ready to begin writing the code yet. So he pulled out a piece of paper and drew a couple of squares, and then he put in the numbers from the array. Next he drew a couple more pictures where he move the squares around and showed me visually how the sorting algorithm would work.

Some things you can do to clear your mind and solve the problem:

  • Take a break
  • Talk to a colleague
  • Whiteboard the problem/concept
  • Sleep on it!

Don't be surprised if you wake up in the middle of the night with the solution.

share|improve this answer

I think it will surely help to become an efficient professional programmer/developer if you can. However, thinking about a problem while translating the solution into program logic IMHO needs training, so I see no problem if you serialize these tasks - you just need to be able to successfully complete both. Thinking about a solution from start to end before starting to code surely has its merits, but you need to be a somewhat patient character for this.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.