Introduction to Thinking in Properties

Get introduced to what we'll be going through in the chapter.

In the last chapter, we went over basic properties, including their syntax and included generators. We played with the biggest(List) function, ensuring it behaved properly. We should now have a good idea of what a property looks like and how to read them. Still, it can take a long time to feel like we know how to write effective properties. Remember that practice makes perfect.

Writing good properties is challenging and requires more effort than standard tests, as we found in the previous chapter. In this chapter, we’ll go through techniques that transition from using the standard tests to thinking in properties that feel natural.

We’ll go over a few tips and tricks to help us learn how to write decent properties for tricky situations. The tricks we are going to use are:

  1. Modeling
  2. Generalizing example tests
  3. Finding invariants
  4. Symmetric properties

Get hands-on with 1400+ tech skills courses.