Pattern catalog
Patterns are common ways of doing things, like recipes. People have patterns for solving equations, making web pages, wrapping gifts, all sorts of things. Part of learning a skill is learning the patterns that help you be more effective.
Here are patterns on this website. This list can help you find the patterns you need to do a task.
Name | Tags | Summary | Where referenced |
---|---|---|---|
Accumulate error messages | Make a variable for error messages. Append all messages to that variable. |
More conditions | |
Basic page template | HTML | A template for a basic page. |
Page template |
Break down complex conditions | Businesses often have complex rules. That can lead to code that is complicated, and hard to read. Use boolean variables for individual conditions. Your code will be easier to think about. |
More conditions | |
Computation at the top, simple output at the bottom | Put code for complex calculations in the top part of your program. That code puts values in variables. The bottom bit makes HTML using those variables. |
More conditions, Conditional styles, Validation basics, Images | |
Error messages as a flag | Use a variable containing error messages as a flag. If it's MT, no errors. |
More conditions, Conditional styles | |
Flag | Use a variable as a flag. Set the flag if any of a number of things happens. After, check the flag to see if any of those things happened. |
More conditions, Checking permissions, Log in/out, Validation basics | |
Multifield validation | For each input to check:
Combine the error messages for each field. |
Multifield validation | |
Multiway if | Make a chain of |
Conditional styles | |
Same page validation | Forms | Put a form and its validation code on the same page. |
Same-page validation, Log in/out |
Separate input from processing | Forms | Put input and validation in one program. Put processing code in another. Use the session to send data from one to the other. |
Beginning forms |
Pagination
- Page 1
- Next page