feat(chapter4): code samples for chapter 4