Write a Program

Writing a program

This way a first program could be entered into the computer. Writing your first program in Java. Home Small What makes you think it should be programmed differently? A very few of us, especially if they're just getting started, will be creating a program that just works. Instead, we get a tons of bugs, and once we've worked through them, the program probably won't work properly.

When you have typed several hundred rows of source text, you may have tens or even hundred of compile bugs to fix, and once you get through them, you will still be confronted with a daunting task of Debugging, because you will not know where your bug lies in these 200 rows of source text.

One of the keys to avoid this disappointment is to get small--unless I have an utterly good notion of what needs to be done, the first thing I do when I run any program is to get a program that I can run. It probably doesn't do much; it could just show the welcome page.

However, it does something, and it means that I have no compile bugs to handle in this part of the snippet. It is unlikely that you will be able to test the remainder of your program if you cannot make the basics to work. As soon as I run a very easy program, I try to include small parts of the source which are closed enough to be canvassed.

A further benefit is that if I only have small supplements to my source text, I will restrict the number of tiresome bug reports that I have to process at once. Like everyone else, I hates handling fifty bug reports, but I'd rather handle fifty bugs in blocks of three or four at once!

It will be apparent in many cases what part of your program you should write next (maybe because everything else depends on this track of code). When you are not sure what to write next, don't be shy about writing easier codes than you might think. It' okay to write some elementary functions without having to fill in all the detail when it is enough to test an acceptance of a part of the source which is more important.

It is not always clear what is most important, of course, but in general it is what is at the heart of the programme. It could be the gaming machine in a simulation; in an AI program it could be the learning-alorithm. It may be possible to establish a networking link in a networking app.

Prioritise the program kernel over functions that may never be used! Eventually, once I have added some part of the source I test it to make sure it works as I expect. At least if not, then I know that the error in the source I just added must be.

That means that when I debug, I can disregard most of my old, working source and concentrate on what happens when the new source is executed. You may have the wrong ideas about how quickly your program will run. It is better to capture it when you begin for the first time than when you have created a whole program built on this premise.

As soon as you can actually start playing with the frame of your program, it is much simpler to get an idea of what the program should do. One of the main reasons for the step-by-step structure is that you can concentrate on a individual part of your program. There is no need to think about whether each line of coding works, as you have experienced most of them.

So you can concentrate all your energies on the new issue you're resolving instead of dealing with thousands of rows of untested codes. Working on a program will help you concentrate on a discreet part of the program.

When you move between several parts of the source text, you have to keep more things in your mind at once (or download and discharge information every single change of what you are working on). You will also encounter the issue of having to get to a breakpoint in several parts of your source before you can test it.

So if your add-on would terminate another piece of coding at one point, you must exit that add-on before re-testing your semi-functional program.

Mehr zum Thema