Chapter 13. 12 object-oriented programming: A Trip to Objectville

Image

In this book you’ve used functions to abstract your code. And you’ve approached coding in a procedural manner using simple statements, conditionals, and for/while loops with functions—none of this is exactly object-oriented. In fact, it’s not object-oriented at all! We have looked at objects and how to use them in our code, but you haven’t created any objects of your own yet, and you haven’t really approached designing your code in an object-oriented way. So, the time has come to leave this boring procedural town behind. In this chapter, you’re going to find out why using objects is going to make your life so much better—well, better in a programming sense (we can’t really help you with other areas of your life and your coding skills, all in one book). Just a warning: once you’ve discovered objects you’ll never want to come back. Send us a postcard when you get there.

Breaking it down, a different way

Image

Remember back in Chapter 1 when we said there were two skills that you needed to learn to code? The first was breaking a problem into a small set of actions, and the second was learning a programming language so that you can describe those actions to a computer. At this point, you’ve learned a good deal of both ...

Get Head First Learn to Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.