Writing in Pseudocode

Dec 10, 2015

0
Writing in Pseudocode

Writing in Pseudocode

Pseudocode is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled natural language rather than in a programming language. When studying GCSE and A Level Computing you need to be familiar with reading and writing pseudocode.Pseudocode is often used as a detailed step in the process of developing a program. It allows designers or lead programmers to express the design in great detail and provides programmers a detailed template for the next step of writing code in a specific programming language.

Because pseudocode is detailed yet readable, it can be read by the team of designers and programmers before programming is undertaken. Catching errors at the pseudocode stage is less costly than catching them later in the development process. Once the pseudocode is accepted, it is rewritten using the vocabulary and syntax of a programming language.

This is a useful video explaining why and how to write in pseudocode.

https://www.youtube.com/watch?v=4G0EYfrrDT8

Tips For writing Pseudocode:
  • Don’t bother to declare variables
  • Use INPUT to take in values to the system (e.g. Name, Answer, Age etc.)
  • Use OUTPUT to display a value or message from the system
  • Indent code that appears inside blocks such as IF blocks or WHILE blocks
  • IF blocks should end in END IF
  • WHILE blocks should end with ENDWHILE
  • FOR blocks should end in LOOP (although NEXT is acceptable)
  • No end of line semicolons or enclosing brackets are needed (like in Javascript)

Although Pseudocode is basically English language, try to use a more mathematical syntax (e.g.  use “>” rather than writing “bigger than”) It makes it easier to translate to real code later.

Try to break down each line so that it is just one instruction. Its preferable to have many short instructions rather than very long confusing lines containing multiple conditions.

Useful links:

https://www.vikingcodeschool.com/software-engineering-basics/the-elements-of-pseudocode

Leave a Reply

Your e-mail address will not be published. Required fields are marked *