Content

How to think like a programmer

Page is part of Articles in which you can submit an article

written by owen on 2005-Mar-29.

A good program starts in the head of a programmer. You first consider whether the problem you are about to solve (aka the program) is impossible to write or not. In a class situation a teacher will usually give you a solvable problem.

When given a problem, a lab assignment or whatever, try to break it up into parts. Some parts of a program have to be completed before other parts and from this you should be able to figure out where to start writing your program. Think of it as a river (flow chart) that runs from the top of a mountain down until it reaches the sea. It is not a lake.

In most cases your program will involve some sort of menu. Think of the menu as a series of IF_STATEMENTS. If one thing happens THEN another thing happens and so on and so forth. Sometimes only after you start writing the program you will be able to finish it (hard to explain, look up momentum).

Things to do

  • Most new programmers often make the mistake of trying to put the entire program into their head - this is not good. Write little parts of the program one at a time ( in a logical order ).

  • Do not write the entire program then try to compile it. A program works one line at a time. Start out by writing the first 5 lines of the program - then compile. if java sucks, compile after every 10 lines. This will help build up your skills and ensure that by the time you reach the end, the program will actually run with out errors. FIND AND FIX ERRORS AS YOU GO ALONG. Errors will be harder to find after you finish typing 500 lines.
  • Look at other peoples code.
  • Start writing the program
  • Copy and paste. If you have written a similar piece of code before copy it and use it in you new program. Donot waste time writing it again.
  • Ask questions, though they maybe stupid, its a learning process. Programmers become better through constant research and trial and error.
  • Donot wait until the last minute to write you program, the sooner you start - the better.

permanent link. Find similar posts in Articles.

comments

  1. Getting the entire program (in my case webapps) in your head is indeed impossible with big apps. I usually get the big outlines in my head first and from there I start "scuplting" the software. Reusing structures allways helps too. Not necesarily the exact code, but just the way it is build up.

    by Arie 2005-Mar-29 

  2. i suck at thinking like a programmer. i think way too much and way to far ahead.

    by michael_halvorsen 2005-Apr-01 

  3. im like you michael, before I even finish what I was thinking of last week I am itching my pants of because I just thought of 20 other things I need to be working on.

    My to do list is never ending.

    by alex 2005-Apr-15 

  4. i think some people are just natural programmers, and some are not and probably never will be. Thanks to the bastards who put programming in my course when my job field does not require it at all. Maybe its poor teaching quality, it probably is, but its also the fact that I'm new to it and never done it before in high school, its hard to find someone who does'nt think with his fingertips and then tries to explain something to you, what a joke!!!

    by carnage123 2006-Feb-26 

  5. yeah dear ...while programming Happy sleeping????
    its true in mine case

    by sandeep 2006-Mar-22 


comment