Some common patterns and representative implementations against invariants.