Coding at Home: April 9th

Live stream, today at 1pm Irish time: https://twitch.tv/thecodehub or catch up on the kids.code() playlist on YouTube.

More Types

We’re going to go over types and initializers (chapter 6 of Everyone Can Code Puzzles) one last time today. It’s a deep subject, and a bit of a shift from our previous lessons, which is why we’re spending a few days on it.

We saw one student use two turtles to draw the picture above, each instance of a turtle taking responsibility for drawing a different part of the picture. This is a nice use of instances to divide up tasks. A lot of what we’re covering these days is about organizing our code.

If you practice your Types and Initialization playgrounds you’ll get a ton of work on organizing your code. I would recommend “Setting the Right Portal” for practice with setting properties on instances. For organizing your code, the “Train Your Expert” page is excellent.

The Anatomy of a Type

Lastly, we looked at how a type is constructed, just to have a look at the guts of what we were doing.

For kicks, we designed a Dog type. This is something you might do if your code was part of an application that cataloged dogs… or trained them. We defined a property, called name, and a method, called chaseStick().

The point of this exercise wasn’t for us to go off creating our own types now. It was just to give you an idea of how types are constructed to demystify the code you’ve been using so far.

Today’s Session

For today’s session we’re going to dive into another new playground, called Shapes.

This will be our last stop in Chapter 6 of Everyone Can Code Puzzles. We’ll get to see a few new types, create some instances, and interact with those instances.

See you at 1pm!

One thought on “Coding at Home: April 9th”

Leave a Reply

Your email address will not be published. Required fields are marked *