Funding for 'IT Lab' Project, Phase 1: Progress of sticker sales. Purchase a sticker to help us reach our target.Updated: 2010-02-28 11:53
10.7%
Simple Programming


by
Donald E Gaminitillake

With the increased popularity of programming courses in our universities, technical institutions and schools, there is a need for an easy-to- read textbooks on computer program design in local languages. Unfortunately most of the books are written in English and 70% of the G.C.E.O/L students unable to pass in English Language. There are many introductory programming texts using specific languages such as Pascal, Cobol C+, Darwin etc but they usually gloss over the important step of designing a solution to a given programming problem.

Too often, programmers who are faced with a problem launch straight into the code of their chosen programming language, instead of concentrating on the actual problem at hand. They become bogged down with the syntax and format of the language, and spend many hours getting program to run in a computer without attending to the end user requirements.

 Computer programming is an art. Many people believe that a programmer must be good at mathematics, have memory for figures and technical information, and be prepared to spend his lifetime sitting at a computer, typing programs. However given the right tools, and steps to follow, any one can write well-designed programs.

Experienced programmers will design a solution to the program firstusing paper and pencil, desk check this solution, and then code the program in a chosen program language.

The first step is to define the problem. This step involves carefully reading and rereading the problem until one understand it completely what is required. The problem can be divided into small components. Example inputs, outputs and processing steps to produce the required outputs. With this one can outline the solution. This initial outline is a rough draft of the solution.

The outline of the solution then will be expanded into an algorithm. Most of the people get scared when they hear the word algorithm.It is like a cake recipe. Written in simple English and is not a formal document. An algorithm must be lucid, precise, give correct solution in all cases and eventually end. This is nothing other than a set of precise steps that describe exactly the tasks to be performed and the order in which they are to be carried out. 

In the draft following tasks are written. The processing steps with any subtasks. Control structures with all repetition loops. All major variables, record structures, mainline logic and hierarchy charts. Every flow chart should begin and end with a terminal symbol.
The process symbol represent any single process in an algorithm. Example performing calculation, reading input etc. The predefined process symbol represent a module in algorithm . These are some sample of symbols using in a flow chart. Apart from these flow charts Nassi-Schneiderman diagrams are use to represent algorithms. They offer a diagrammatic approach to algorithm design but are not as bulky to draw as flowcharts. Nassi-Schneiderman diagrams (N-S Diagram)  use pseudocode-like text in rectangular boxes for those who prefer a more visual method of representing algorithm design than pseudocode.

Example of a simple Nassi-Schneiderman diagram (N-S Diagram)

Simple IF statement

 

I would also like to mention that this procedural design do have some limitations when large systems are developed and maintained by large team of developers. The reason is developers are always not aware of work being performed in the system by other members of the team. As a result the same blocks of codes are sometimes duplicated several times in different parts of the system. Ideally it has to be occur only once and remain available to be reused. Today “Object-oriented” programming and design is emerging as an important technique. An object-oriented program is a set of interacting objects rather than a set of functions. Objects aresaid to encapsulated (enclose in a capsule) their data and the process that act on those data. Simple example in the real world is a motor car. Each car has a name in the form of a licence plate and has attribute to describe it: make, model, number of doors, body length, engine power, and colour. Cars also have things that they can do: turn, stop, accelerate, break etc. This means that (cars) objects can be used in several places in one system or across several systems at the same time and codes inside the (number of people traveling in the car) object can be easily changed without interfering with the rest of the system.

Getting back to procedural designsimple programming testing the correctness of algorithm is most often forgotten step. This is the most important step in the development of a program. The main purpose of this is to identify major logic errors early, so that this can be corrected easily. Test data needs to be walk through each step in the algorithm to check that the instructions described in the algorithm will accurately do what they are supposed to perform. The programmer with help of pencil and paper walks through the logic of the algorithm, exactly as the computer would, writing on paper the track of major variables.

Only when all the above conditions have met the programmer sits in front of a computer and actually code the program into any chosen programming language. Once the coding is completed the program is run on the computer. Usually this is the most rewarding step in the program development process. If the program has been well designed, the usual time-wasting frustrations are reduced to minimum.

Next most important task is program documentation. This is not the last step of the program development progress. It is really an ongoing task from the initial definition of the problem to the final result. The program maintaining team will refer to these documentation in order to make some changes. These changes are performed by a different programmer from the one who initially wrote the program. If the program is well designed using correct techniques, the code will be seen as self documenting, resulting in easier maintenance.

Simple programming is a subject of its own can run into several books as the topic branches into various other sections. The basic reasoning remains the same but with digital thinking of youth a dawn of a new era is seen.

Can we do a Simple programming using Sinhala? Yes but there is a limit. The limit is one can use only the encoding given in the SLSI 1134. Rest of the Sinhala characters does not have an utf value. Therefore we got to amend our SLSI 1134 for Sinhala to be used in a computer. (utf = UCS/Unicode transformation formats, UCS= Universal Character Set)

For Reference readings about UTF visit.

http://www.ietf.org/rfc/rfc2279.txt

http://www.i18nguy.com/unicode/surrogatetable.html

http://bytes.com/groups/ibm-db2/658181-how-get-unicode-value-utf-8-character

http://en.wikipedia.org/wiki/UTF-8

Share/Save
No votes yet

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options