What is meant with refinements?
Refinements can be used in flow charts, pseudocode, structure diagrams or other design tools to go into further details for a complex process or function.
The top level design tool can simply mention the function. Then you make a new design for the function in detail.
1. SET length TO prompt_for_length()
2. SET breadth TO prompt_for_breadth()
3. SET area TO calculate_area(length, breadth)
4. DISPLAY area
1.1 DEFINE prompt_for_length FUNCTION
1.2 SET valid_length TO FALSE
1.3 WHILE valid_length EQUALS FALSE
1.4 PROMPT USER FOR length INPUT
1.5 SET valid_length TO validate_length(length)
1.6 RETURN length
1.5.1 DEFINE validate_length FUNCTION
1.5.2 IF length IS INTEGER AND > 0 AND < 1000
1.5.3 RETURN TRUE
1.5.4 ELSE
1.5.5 RETURN FALSE
2.1 DEFINE prompt_for breadth FUNCTION
2.2 SET valid_ breadth TO FALSE
2.3 WHILE valid_ breadth EQUALS FALSE
2.4 PROMPT USER FOR breadth INPUT
2.5 SET valid_ breadth TO validate_ breadth(breadth)
2.6 RETURN breadth
2.5.1 DEFINE validate_breadth FUNCTION
2.5.2 IF breadth IS INTEGER AND > 0 AND < 1000
2.5.3 RETURN TRUE
2.5.4 ELSE
2.5.5 RETURN FALSE
3.1 DEFINE calculate_area FUNCTION
3.2 SET area TO length * breadth
3.3 RETURN area