4

It has often been emphasized that before putting anything into code one must try to solve the problem on paper. This means developing the algorithm and stuff like that. I feel it means strategizing as to how we will deal with the problem.

Recently I started doing a bit of practice coding on online judges and some projects for college. I found that I have the habit of directly grabbing the problem and sitting directly on the computer and starting to code the solution. I feel this is something that is blocking me from progressing forward. I find that I have no motivation to solve it on paper. I tried many times to solve the problem on paper. But I would end up staring at the page and finally sitting back onto the computer.

So I need help: What are the benefits of solving problems on paper/white boards and how can I become better at it? What kind of things should I write and how to make the most of it?

(I apologize if the question is too broad or not constructive, but it is something that is troubling me and so I decided to give it a try on SO. Also I don't know if it helps but I program in Java and C++)


EDIT: I discovered that the topic was put on hold as primarily opinion based. I present my case here for consideration:

FROM THE FAQ

Constructive subjective questions:

  • inspire answers that explain “why” and “how”
  • tend to have long, not short, answers
  • have a constructive, fair, and impartial tone
  • invite sharing experiences over opinions
  • insist that opinion be backed up with facts and references
  • are more than just mindless social fun

Here is what I feel:

  • My question is a question that asks for HOW TO USE PAPER / WHITE BOARD TO OUR BEST ADVANTAGE.
  • I don't know if it has long or short answers but I feel that it will have longer answers than our usual questions.
  • I have not placed any kind of opinion neither have I become partial towards one aspect of the question.
  • I am obviously asking for experienced answers. I know everybody here has worked a lot more than me in this field and I need the help of your experience to solve my problems. Isn't that was SO is all about?
  • I don't know if the opinion can be backed by facts or not but I would definitely suggest giving references for helping me towards my ultimate goal - improvement.
  • This is not a fun discussion but a problem that is apparently one of my weaknesses. I need to know how to deal with it. I feel SO can help me.

That is all I want to say. If this is not the place to get the answer, at least show me the path that I can follow that will lead me to solving my problem. Also I apologize if the tone of this question sounds argumentative or offensive; I just want some help.

10
  • 1
    IMO you would have a better abstraction if you draw the main components in paper or somewhere else, describe their state and behavior and relate them before code anything. So, you could then have an idea if your model will support what you're seeking. Also, you can use paper to define test cases for your algorithms even before write any piece of code for them. Mar 14, 2014 at 15:29
  • So, what exactly do you when you sit down behind the computer? At some moment you must have thought about how to solve the problem. You don't just sit down and write down the solution in code without knowing how to solve it.
    – Jesper
    Mar 14, 2014 at 15:33
  • 1
    I guess that there is no single answer to your question but in my opinion it is fine to just directly code if it is a problem that you see as trivial. What a programmer sees as 'trivial' however changes as he gains more experience. I find that beginner programmers tend to need to write out nearly all their code on paper first. More advanced programmers still resort to paper but usually only when it is a very complicated algorithm or when doing class level design (such as UML class diagrams) or business analyst type activities. Mar 14, 2014 at 15:34
  • 2
    If you can code a good solution right away, you are not solving hard enough problems.
    – Niklas B.
    Mar 14, 2014 at 15:52
  • 1
    You're confusing several things: 1) With something like a linked list it's often worthwhile to write down on paper how the data structures "mutate" as you add/remove items. 2) It is often very worthwhile to prototype different concepts (write little programs) to "get a feel" for them. 3) With a large project it's important to design before you build (which implies writing stuff down in words, either on paper or in some sort of document). But following any "methodology" simply because folks say it's "the right thing to do" (without you understanding why) is exceedingly unwise.
    – Hot Licks
    Mar 14, 2014 at 16:00

0

Browse other questions tagged or ask your own question.