Classes part 1 - tstorrnetnz/teaching2022 GitHub Wiki

How to think like a computer scientist (HTTLACS)

Otago Workbook L3

I am really pleased with how you are making progress. It has been good having conversations with you and seeing what progress you are making.

We have not quite finished Level 2 (we have not revised lists - but this fits well with some other L3 topics) But are now going to cover some things that are Level 3.

The content this week is quite difficult to understand. You may need to go over it several times.

Learning Aims - understand and use the concepts of scope and classes

Scope is a fairly advanced topic that you will now need to have some understanding of. I've made three videos that describe some of these ideas. In reality though, scope is something that is learned by doing - and often through mistakes where something is not working - though you think it should. Take a look at the videos below.

Classes are an integral part of understanding java and also scope in Java.

You'll need to use the L3 Otago book to understand this - see link at the top of this page. Chapter 1 is 39 pages in length - yet all is quite important. How to think like a computer scientist - chapters 10 and 11 are also recommended reading here. Note - this is a fairly difficult section. You may need to return to it several times.

Some supporting videos:

These are also available here

Repls referred to in the lesson:

Classes

For you to do:

  • Do the program on pg12 of the L3 Otago book. The code listings are here and here. Do this in a repl.

The key problems in repl.it are 61, 62 and 67 & 68.

In my experience, this takes a while to understand - there is a lot of new ideas to take in. Tutorial tomorrow at 11 for those who need a second go!

Extension work

If you complete all the four above, including the extras that are in each problem, well done!