Written Descriptions
Written Program Descriptions
Written Description: A written description is a narrative explanation of the program’s logic using natural language. It focuses on conveying the overall flow and behavior of the program without diving into the details of individual steps. It is more suitable for high-level understanding and communication between stakeholders, such as clients, project managers, or non-technical team members. Written descriptions may lack the precise syntax and structure found in pseudocode or programming languages.
Example
"The program prompts the user to enter two numbers. It then calculates the sum of the two numbers and displays the result on the screen."
From the above the developer should be able to ( perhaps after asking some additional clarification questions) code the program described.
Pros:
- Accessibility: Written descriptions can be easily understood by a wide range of stakeholders, including non-technical individuals. They don’t require any programming knowledge or familiarity with specific syntax, making them more accessible for communication purposes.
- Flexibility: Written descriptions provide flexibility in terms of language and format. They can be written in plain language or tailored to the target audience, allowing for customization and adaptation to different contexts.
- Clarity: Well-written descriptions can effectively convey the overall flow and behavior of a program in a concise and understandable manner. They focus on the program’s purpose, requirements, and expected outcomes, enabling stakeholders to grasp the essence of the program without getting bogged down in technical details.
Cons:
- Ambiguity: Written descriptions may be prone to ambiguity or misinterpretation due to the use of natural language. The lack of precise syntax and structure found in programming languages can lead to different interpretations or misunderstandings of the intended logic.
- Lack of Detail: While written descriptions provide a high-level understanding of a program, they often lack the level of detail necessary for implementation. They may not capture the specific steps or decision-making processes involved, making it challenging to translate them directly into code.
- Difficulty in Validation: Unlike pseudocode or actual code, written descriptions are not easily verifiable or testable. It can be challenging to confirm if the described logic is correct or if it meets the desired requirements without implementing it in a programming language.
- Limited Reusability: Written descriptions are not directly executable and cannot be reused as code snippets. They serve more as documentation or communication tools rather than practical implementation instructions.
Pseudocode
Pseudocode
Pseudocode is a way of representing a program’s logic using plain language. It helps in understanding the algorithm without getting into the specifics of any particular programming language.
Example – program to add two numbers
1. Start 2. Declare variables num1, num2, sum 3. Read num1 from the user 4. Read num2 from the user 5. Set sum = num1 + num2 6. Display "The sum of", num1, "and", num2, "is", sum 7. Stop
Pseudocode aims to strike a balance between human-readable natural language and structured programming constructs. It helps programmers communicate and understand the algorithm’s flow and logic, making it easier to translate into actual code in a specific programming language.
This program code is easy to read but can easily be converted into fully working code by a developer. As pseudocode isn’t a real language there is not official set way to write it, since pseudocode need only be logically correct, no syntactically correct.
Edexcel iGCSE Pseudocode
All exam boards here their own versions of psuedocode. Here is the official pseudocode guide from Edexcel. It is important to note that while you don’t strictly need to follow this list exactly when writing pseudocode in the exam, it is highly recommended as otherwise you risk losing marks in the exam.
EdExcel Pseudocode Command List
Pros of Pseudocode:
- Readable and understandable by both technical and non-technical individuals.
- Provides a clear and structured representation of program logic.
- Language-agnostic, allowing for flexibility and adaptability to different programming languages.
- Facilitates validation and testing of program logic before implementation.
Cons of Pseudocode:
- Subjective and open to interpretation.
- Lack of standardization in syntax and format.
- May lack implementation-specific details.
- Not executable code, requiring translation into an actual programming language.
Program Code
Program Code
Program code is code that can be directly executable (or with a few minor changes) in the target language.
Example
# Read input from the user num1 = float(input("Enter the first number: ")) num2 = float(input("Enter the second number: ")) # Calculate the sum sum = num1 + num2 # Display the result print("The sum of", num1, "and", num2, "is", sum)
Pros of Program Code:
- Precision and Execution: Program code provides precise instructions that can be directly executed by a computer, resulting in functional software or applications.
- Implementation-Ready: Program code is the actual implementation of the logic, making it executable and ready for use.
- Verifiability: Program code can be tested and validated to ensure that it produces the desired results.
- Reusability: Code can be reused in other projects or parts of the same project, saving development time and effort.
- Efficiency: Program code is optimized for performance and can be fine-tuned to achieve optimal speed and resource usage.
Cons of Program Code:
- Complexity: Code can be complex, especially for large and intricate programs, which can make it harder to understand and maintain.
- Technical Knowledge Requirement: Understanding and working with code generally requires knowledge of programming languages, which may pose a barrier for non-technical stakeholders.
- Limited Accessibility: Program code may be less accessible and understandable for individuals who are not familiar with programming concepts or syntax.
- Less Flexibility: Code is tied to specific programming languages and may require significant changes to port or adapt to other languages or platforms.
- Lack of Abstraction: Code focuses on implementation details and may not provide a high-level overview of the program’s logic, making it less suitable for communicating concepts to non-technical individuals.