1/19
A set of key vocabulary terms and definitions drawn from the lecture on applying the six-step Design Recipe when writing Java methods.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Design Recipe
A six-step, pre-coding framework that guides you from understanding a problem to implementing and testing the final Java code.
Step 0 – Understand and Restate the Problem
The phase where you clarify the required input, the expected output, and the task the code must accomplish before writing any code.
Input
The data a method or program receives to work with, e.g., a double representing a circle’s radius.
Output
The data a method or program returns after processing, e.g., a double representing a circle’s area.
Step 1 – Data Definitions
The step in which you specify the exact data types (primitive, object, collection, etc.) of inputs and outputs.
Primitive Type
A basic Java data type such as int, double, char, or boolean.
Step 2 – Method Signature
The Java header that names a method, lists its parameters, and states its return type.
Purpose Statement
A plain-English comment that explains what a method is supposed to do and what it returns.
Step 3 – Examples and Tests
Creating concrete input-output pairs (test cases) to predict and verify a method’s behavior, including normal and edge cases.
Edge Case
An atypical or extreme input (e.g., zero or negative values) used to test how robust a method is.
JUnit
A popular Java framework used to automate the execution of test cases created in Step 3.
Step 4 – Skeleton / Method Template
A high-level outline or pseudocode of a method’s logic written before the full implementation.
Pseudocode
Language-agnostic, structured comments or steps that describe what code will do without using full Java syntax.
Step 5 – Implementation, Testing, and Refinement
Writing the actual Java code, running tests, and polishing the solution according to results and best practices.
Best Practices
Agreed-upon coding conventions and techniques that improve readability, maintainability, and reliability of code.
computeArea(double radius)
Example method that returns Math.PI * radius * radius to compute the area of a circle.
toFahrenheit(double celsius)
Example method that converts Celsius to Fahrenheit using (celsius * 9 / 5) + 32.
Test Case
A specific scenario consisting of an input and its expected output, used to verify correct behavior of code.
Method Header
The first line of a Java method that includes access modifier, static keyword (optional), return type, name, and parameters.
Skeleton Code
An incomplete version of a program or method where major structural elements are present but detailed logic is not yet implemented.