Day 7: Lots More Objects

We took a detour from the notes yesterday morning and built some classes to represent matrices. One reason was to show students how to break a problem down into pieces and solve them one by one; another was to introduce the notions of encapsulation, polymorphism, and inheritance. Aran Donohue (one of the TAs here in Toronto) thinks that inheritance is over-taught, and taught too early—he may be right, but it's also hard to avoid, since so many libraries and frameworks (and tutorials, but that's a circular argument) expect familiarity with it.

We looked at operator overloading and (very briefly) at design patterns in the afternoon, then did a modeling exercise. What classes would you create if you were writing a program to simulate solar systems? What would those classes' responsibilities be, and which classes would collaborate with which others? The most creative solution included Santa Claus; the most complete took collisions and explosions into account.

Day 8 will be quality assurance and unit testing. By the time we're done, we'll be halfway through...

In the wake of posts about Shopify's support for white nationalists and DataCamp's attempts to cover up sexual harassment
I have had to disable comments on this blog. Please email me if you'd like to get in touch.