Patterns for selection

Quick take
Patterns for an intro programming course.

Joseph Bergin

There are four kinds of patterns here: Selection patterns proper, Strategy patterns, Auxiliary patterns, and some Stylistic patterns.

The Selection patterns are as follows. These choose different kinds of selection structures.

Whether or Not

Alternative Action

Return Not Else

Conditional Expression

Range of Possibility

Sequential Choice

Unrelated Choice

Independent Choice

Partial Dependence

The strategy patterns are as follows. These help you design a selection.

Short Case First

Default Case First

The auxiliary patterns are as follows. These give general advice about simplifying the structure of your programs.

Positive Condition

Function for Complex Condition

Function for Complex Action

The stylistic patterns are a follows. These are concerned with the readability of your programs.

One Liner

Brace All

Braces Line Up

Indent for Structure