8. Functions and Methods
Note
Project: Replace all the photos in the Facebook feed with photos of kittens or puppies.
Your kittenbook code is a mess. I’m sorry to say so, but it’s a complete mess. All your variables are global (see the later section, “Scope”), and it is unclear which instructions are meant to achieve what job. I suppose the mess is really my fault because I told you to write the code the way it is written, but it’s a mess nonetheless. You might be questioning my methods. If I’m supposed to be teaching you how to program, why would I tell you to write bad, messy code? I have my reasons, I promise. First, you can’t appreciate the value of clean code until you have worked with messy code. Second, to understand the tools you need ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access