Chapter 16. Patterns: learning to sew

 

This chapter covers

  • Best coding practices
  • Model-View-Controller pattern
  • Delegate pattern

Some of you are probably worried that this chapter is about sewing, but relax. It’s about coding patterns. What in the world are coding patterns? Honestly, they’re kind of like sewing patterns, hence the analogy. In my goofy mind, there was some guy a million or so years ago (yes, I’m exaggerating) who wanted to make a shirt. He got a roll of fabric (or went and shaved his sheep first) and set about cutting it up to make the required pieces. After trial and error, he finally found the best combination of pieces to sew together to make a shirt. If he was smart, he probably then made a copy of the pieces and set those aside so he could trace those patterns the next time he wanted a shirt and he wouldn’t have to go through the trial and error again. Pretty smart guy!

Well, some pretty smart folks have done the same thing in the coding world. Let’s learn about that now (no sheep were harmed in the writing of this manuscript).

16.1. Design patterns, defined

16.2. Types of design patterns

16.3. Summary