translate and sample code of chapter