What are the steps in developing a computer program?

All programming involves creating something that solves a problem. The problems can range from something of great scientific or national importance, through to something as trivial as relieving personal boredom!

This section describes one approach to solving such problems - think of it as a rough guide to the things you should do when entering the land of programming.

In broad terms, those things are:

  1. Identify the Problem
  2. Design a Solution
  3. Write the Program
  4. Check the Solution

Of these, only the third step is usually called "programming", but as you'll see later, it's probably the least important stage of the process.

Identify the Problem

In fact, this stage should really be called identifying the solution because what you're really trying to do is to tie down exactly what it is that you're trying achieve.

There are two stages to identifying a solution:

  • Requirements
  • Specification

Requirements

The first step is to examine the problem carefully to try to identify what qualifies as a solution. A single problem may have many different solutions, but they will all have something in common. So here you're trying to work out exactly what your program will be required to do.

For example, if we were asked to write a calculator program, we could choose many different ways for the user to enter calculations - from entering equations, pressing buttons or even writing them on the screen - but if the software can't add up correctly then it won't have solved the problem. Therefore our first few requirements must be that:

  • the user can enter sums [we don't care how they do this]
  • and that the program will then evaluate those sums correctly
    and display the result for the user.

We also have to decide what sort of sums our calculator will be required to evaluate. Again, we have a fair amount of choice - we could be ambitious and ask it to solve simultaneous equations or complex expressions, however since this is our first program we should probably make the requirements more simple. So the third requirement is that:

  • The calculator must be able to evaluate sums made up of two whole numbers [integer operands] and one addition [+], subtraction [-], multiplication [*] or division [/] sign [operator].

Note that computer scientists traditionally use * instead of x and / instead of � to indicate multiplication and division respectively.

Thus our calculator must be able to deal with sums like 1 + 1, 10 - 6, 43 * 5 and 42 / 7. However it won't have to handle 67.345 + 6¼, the cube root of PI or 152.

Specification

The second step is to then look at the list of requirements and to decide exactly what your solution should do to fulfil them. As we mentioned above, there are usually many different solutions to a single problem; here, your aim is to decide on which of those solutions you want. Therefore, you're trying to specify, in a fairly accurate manner, just what it is your final program will do.

For example, for the calculator, we've already decided that the program must allow us to enter simple sums and then must evaluate them correctly and display an answer. We must now tie down exactly what this means.

Therefore, we have to decide which method of entering sums to use. We could specify any one of a number of methods, but for now, we'll choose a simple method. We should also specify what other behaviour we're expecting the program to have:

  • When the program runs it will display a welcome message, followed by some simple instructions.
  • The program will then display a prompt sign [[number]>] and the user can then type the first number of their sum at the keyboard followed by the RETURN [ compile -> debug will often be repeated many many times before the compiler is happy with it. Luckily, the compiler never ever gets cross during this process - the programmer on the other hand...

    It should also be said at this point that it isn't actually necessary to write the entire program before you start to compile and debug it. In most cases it is better to write a small section of the code first, get that to work, and then move on to the next stage. This reduces the amount of code that needs to be debugged each time and generally creates a good feeling of "getting there" as each section is completed.

    Finally though, the compiler will present you with a program that the computer can run: hopefully, your solution!

    Solution!

    The final step in the grand programming process is that of testing your creation to check that it does what you wanted it to do. This step is unfortunately necessary because although the compiler has checked that your program is correctly written, it can't check whether what you've written actually solves your original problem.

    This is because it is quite possible to write a sentence in any language that is perfectly formed with regards to the language that it's written in [syntacticly correct] but at the same time be utter nonsense [semantically incorrect]. For example, 'Fish trousers go sideways.' is a great sentence - it's got a capital letter and a full stop - but it doesn't mean a lot. Similarly, 'Put the ice cube tray in the oven.' has verbs and nouns and so on - but it's pretty useless if you wanted to make ice cubes.

    So your program needs to be tested, and this is often initially done informally [or perhaps, haphazardly] by running it and playing with it for a bit to see if it seems to be working correctly. After this has been done, it should also be checked more thoroughly by subjecting it to carefully worked out set of tests that put it through its paces, and check that it meets the requirements and specification - but we shall discuss this more later on in the course.

    Where mistakes are identified, it is a case of donning a Sherlock Holmes hat and trying to figure out where in the code the mistake is. Once identified, the problem should be fixed by changing the code and recompiling. Care should be taken at this point that this fix doesn't break something else, so careful retesting is important. This process is also known as debugging.

    Once all the testing and debugging has been completed, you should be pretty certain that your program works according to your requirements and your specification and so you should finally have a solution to your problem!

    Easy isn't it?!

    Summary

    1. Identify the Problem - What Are You Trying To Do?
      • Requirements
      • Specification
    2. Design a Solution - How Is It Going To Be Done?
    3. Write the Program - Teaching the Computer
    4. Check the Solution - Testing it Understands You

    While this may sound like a great deal of effort to go to to build a simple program, don't worry, as after a while it will become second nature, and for small programs, most of the stages can be done in your head.

    What are the 5 major steps to developing a computer program?

    There are five main ingredients in the programming process:.
    Defining the problem..
    Planning the solution..
    Coding the program..
    Testing the program..
    Documenting the program..

    What are the 7 steps in program development?

    Here's a brief breakdown:.
    Planning Stage..
    Feasibility or Requirements of Analysis Stage..
    Design and Prototyping Stage..
    Software Development Stage..
    Software Testing Stage..
    Implementation and Integration..
    Operations and Maintenance Stage..

    What is the first step in developing a computer program?

    Computer Programming in 4 Steps.
    Step 1: Identify the problem. When students are new to CP, we typically start teaching them how to program and code using tutorials. ... .
    Step 2: Find a solution. ... .
    Step 3: Code it. ... .
    Step 4: Test it..

    What are the six stages in developing a computer program explain each briefly?

    Known as the 'software development life cycle,' these six steps include planning, analysis, design, development & implementation, testing & deployment and maintenance. Let's study each of these steps to know how the perfect software is developed.

Chủ Đề