English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i recently started programming with unix and java, but have been told my programs are all over place, and i should think about the process before i start coding. has any one got any tips or information on the process i need to cover before i start coding when creating a program?

2006-09-29 01:41:53 · 11 answers · asked by Dinkar R 1 in Computers & Internet Programming & Design

11 answers

Learn to write "pseudocode". Basically write the steps your code is to undertake down in plain english and use these as comments in your code.

Once you have refined this and you are happy with the whole process, start filling in the blanks with code.

Also, be careful how you structure your code.Not too many nested loops. Sensible naming. Use of reusable Functions

Keep the thought in mind that someone should be able to read & understand your code without any comments in it.

2006-09-29 01:50:30 · answer #1 · answered by steve-o 2 · 0 0

1. Define your requirements - what do you want the program to do (in terms of functionality).
2. Design the process in terms of distinct components. Process diagrams and Database diagrams do help to crystallize the process.
3. Pick a language, database, operating environment, et.c.
4. Write the code
5. Test it. (fix any issues and retest if necessary)
6. Show your friends :-)

Example:
1) I want my program to convert Fahrenheit to Celsius, and back again.
2) main function that lets user choose conversion direction and enter a number. function to convert C to F. function to convert F to C. function to present result.
3) I am not going to do this step, because any language will do the trick - even Prolog :-)
4) I am not going to do this either, but once you have worked through steps 1 and 2, the structure of the program will be a piece of cake.
5) Run the program and put a whole bunch of numbers in that you already know the answer for. If your program gives the expected answers then you should be right.
6) ...


:-)

2006-09-29 02:14:10 · answer #2 · answered by Extemporaneous 3 · 0 0

There are two main methodologies you should consider these are:

Top-Down and
Bottom-Up

You should be using Top-Down

Basically you write out in english what you want the program to do. Then you decide which bits can be split into smaller "programs" which can perform routine operations and pass the info to the other "prgrams"

Next you write out in english what each of hese smaller programs will do, then we name each smaller program; once named we refer to these as modules.

Then when you know what and how your program will work you begin the process of trying to code each module. Focus on the module and ignore the rest of the program for now and take the module in steps until you have translated the english into code

2006-09-30 01:54:06 · answer #3 · answered by Anonymous · 0 0

Plan it all on paper, using either natural language or psuedo-code. Flow charting can sometimes help.
Write in small modules or sub-routines that only do one task. This will make your code more readable and also reusable.
Use comments to document your code and thought processes. What's blatent to you now may not be so obvious later.
Like any sort of authoring, take breaks. Walk away from the keyboard now and again. Know your own limits.
Above all... HAVE FUN.

2006-09-29 02:15:23 · answer #4 · answered by Steven 4 · 0 0

Start with a high level design.

work out your input and outputs before you go anywhere.
Only after your got your interfaces worked out on paper should you move to documenting the control flow and how the data interacts. Then you can define your procedures, then you can code.

For professional coding, you should have all interfaces, flow, datasets and procedures defined in a "wordy" document before you go anywhere near the computer. Its almost like the code requires little thought because you've broken it down into simple steps via designing the structure.

2006-09-29 01:52:06 · answer #5 · answered by Michael H 7 · 0 0

Just try to make your code as modular as possible, create specific functions/subroutines (or whatever they are called in java) to perform specific tasks. Then add comments into each function explaining what it does. Test them separately and make your main code as simple as possible (putting all the complicated bits in functions).

As for planning, just think what you want to do and how you can sort that into specific functions.

Don't go mad with the planning though, unless you need a proposal to show your boss before you start.

2006-09-29 01:51:54 · answer #6 · answered by Mike 5 · 0 0

Learn to use pseudocode, learn to plan ahead. Also practice - people forget that the only reason that they got good at coding was to practice. We all wrote messy programs at one point in our life, but practice helps us get a little closer to "perfect" :)

Rawlyn.

2006-09-29 02:08:16 · answer #7 · answered by Anonymous · 0 0

Do a search for the term "Pseudocode" and see what comes up. This helps you logically plan your code. With Pseudocode you have the blueprints of your application - the logic is calculated and all you then do is code.

2006-09-29 09:07:05 · answer #8 · answered by Siu02rk 3 · 0 0

Analysis then Design - Read up on UML.

Analysis:
Program purpose
Intended audience - ask questions, identify main points and concepts, use case diagrams etc.

Design
Class diagrams, sequence diagrams, simple flow charts etc.
Use re-usable objects, keep it simple.

2006-09-30 13:57:45 · answer #9 · answered by marmaladiator 1 · 0 0

open a coding program such as java or c++. then u'll need to define the values
Eg Dim answer1 as integer

2006-09-29 01:46:05 · answer #10 · answered by leicestertroy 2 · 0 0

fedest.com, questions and answers