Most of the time, when faced with a problem, programmers would quickly code to handle the problem. Rather than finishing the program quickly, most of these programmers are very likely to spend hours of creating the program, since they lack directions on what to do next. This topic examines the precise and efficient way of developing program, including writing good pseudocode and algorithm, so that programmers could work efficiently and produce the correct result and an error-free program.

PSEUDOCODE

A pseudocode is a way of interpreting or representing algorithm. Pseudocode consists of keywords (usually written in capital) and variables. The keywords are usually control statements, for instance, DOWHILE…ENDDO, IF…ELSE…ENDIF, and many more. Pseudocode could have modules or functions, also indentation. Usually, pseudocode is written using simple English, but it is fine if one is comfortable of using another language. What matters is that a pseudocode must be easy to be read and understood.

When we create a pseudocode, variables cannot be written as how keywords are written because differentiating keyword and variables will be difficult. Also, variables should not have meaningless name; its name should represent what the variables are for.

Pseudocode has three main characteristic, the first is general – meaning everyone who read it could understand what does the pseudocode do-, universal – meaning it is not bound to any programming language-, and consistency – for example, if the writer of a pseudocode uses keyword PRINT to print the output, he/she cannot use keyword WRITE to achieve the same goal as keyword PRINT does in the same pseudocode.

ALGORITHM

An algorithm is the steps to be taken or the logical flow of problem solving. As stated above, an algorithm can be represented using pseudocode, and to broaden reader’s knowledge, a flow chart could also be used to represent algorithm. A more explanation on flow chart will be provided in the upcoming article.

An algorithm must be precise – meaning an algorithm cannot be ambiguous-, produce correct output, and eventually end – the algorithm is not looping forever. In writing algorithm, indentation is needed to increase readability.

PROGRAM DEVELOPMENT FUNDAMENTALS

A program exists since there is a problem that needs to be handled. The main purpose of a program is to ease the user to handle a problem and produce the correct output as how the user wants it. So, the first step to develop a program is to identify the problem. Here, identifying the problem means finding out what are the inputs needed, processes to do, and the expected outputs. After the problem is identified, the possible problem’s solution(s) should be outlined. Simply do brainstorming of the possible solution(s), and shall there be many, choose one that is best suited to handle the problem. Next, the outline should be developed into an algorithm, and this algorithm must be tested for correctness. To check the algorithm, we can use a desk check table which will be elaborated in the upcoming article. Now, programmers can code the algorithm using the best suited programming language to solve the problem. It is also essential to check the code by running it, to see syntax or logical error. Last but not least, the program must be documented to ease other programmers who might take part in working with the program.

In developing a program, there are three most common methods:

  • Procedure-driven – this method focuses on the processes needed. Procedure-driven method is not the same as procedural programming or top-down design. This method is usually used by programmers.
  • Event-driven – this method focuses on the events caused by the user; mouse click, and many more. This method is usually used by system analyst.
  • Data-driven – this method focuses on the data relation. This method is usually used by database administrator.

Aside from the methods above, the study of computer science also know the concepts of procedural and object-oriented programming. Procedural programming is a top-down development design, meaning the solution is divided gradually into more detail steps until all the detailed steps have been completed. This concept also includes modular design that allows a group of tasks be formed to perform the same function. On the other hand, object-oriented programming focuses on the objects and the behavior of the objects, so the process is not the main focus, but the objects used to solve the problem.

In computer science, it is also important to know the differences between variable, constant, and literal. Variable is a memory cell assigned to a specific value. The value of a variable can be changed during the program execution. On the other hand, a constant is a data that has a name and unchanging value during the execution. In C programming language, simply declare const. Literal is a constant as well, but literals have unique value and its name. For instance, the value of 3.14 is known as PHI (π), and PHI’s value is known as 3.14. There are no other values that can be assigned to literal PHI as its value is ‘bound’ to 3.14.

THE STRUCTURE THEOREM

The structure theorem is composed of the following:

  • Sequence – means the execution of a code is straightforward; from top to below/down.
  • Selection – actions can be done if the required condition is either true or false. In pseudocode, keywords that can be used are IF, IF…THEN…ELSE, and ENDIF.
  • Repetition – actions can be done repeatedly while a condition is not met yet. In pseudocode, keywords that can be used are DOWHILE, REPEAT…UNTIL, DO, and ENDDO.

To conclude, an algorithm is the steps or actions to be taken to solve a problem, and a way to interpret it is to use pseudocode. It is important that writing conventions be used in writing algorithm and pseudocode. To efficiently produce good program, programmers should not directly code, but knowing the needs of the program and writing its algorithm should be the first thing done. Concepts and methods of designing program are very important, and rudimentary knowledge of variable, constant, and literal is essential. Lastly, the structure theorem is fundamental as it is used to design program.