You can find code example for this chapter here.
CloudFormation is AWS's version of Terraform: you upload a document that describes what resources you want for the app along with their intended configurations and it creates, modifies, and destroys resources in the AWS account to match reality to the intended state. CloudFormation then keeps track of what is deployed so there is no need for a separate state management, which is one of the pain points when working with Terraform.
But writing CloudFormation templates by hand is unintuitive and often very repetitive. The CDK utilizes a real programming language and uses the CloudFormation template as an output representation. That means, while you get all the benefits of CloudFormation you probably never need to look into the templates themselves.
Next, it offers a constructs library, which means code can be checked more easily in compile-time.