Topic 4—Computational thinking, problem-solving and programming
(45 hours)

(JSR Note: Note that the following two paragraphs actually appear right after the 4.1 heading in the syllabus, but I've rearranged the order of things to suit our purposes better. Nevertheless, the following are two good introductory paragraphs for all of Topic 4)

This should not be taught as a separate topic but must be incorporated and connected to all sections—especially flow charts, pseudocode and programming in the SL/HL core and abstract data structures (HL extension). It is essential that these elements are not addressed in isolation—they have to be approached as a whole.

The basic ideas and their application should be illustrated with non-computer examples. Each basic idea should then be practised in specific algorithmic contexts using concepts drawn from flow charts, pseudocode and programming. The teacher support material illustrates examples such as the home/locker/knapsack for thinking ahead.


4.3 introduction to programming (13 hours)

Nature of programming languages

4.3.1 State the fundamental operations of a computer.         
         video (YT)

4.3.2 Distinguish between fundamental and compound operations of a computer.
         video (YT)

4.3.3 Explain the essential features of a computer language.
         video (YT)

4.3.4 Explain the need for higher level languages.
         video (YT)

4.3.5 Outline the need for a translation process from a higher level language to machine executable code.          
         video (YT)

Use of programming languages

Sub-programmes and objects support abstraction, which facilitates: ease of debugging and maintenance, reuse of code, modularity. There is no programming language specified in the SL/HL core. However, students must use a language that supports the basic constructs on the approved notation sheet.

         Data Types
         Variables ("data types & variables are the notes and chords of programming")

4.3.6 Define the terms: variable, constant, operator, object.
         video (YT)        
         Methods Notes - Part 1 - Introduction & Parameters
         Methods Notes - Part 2 - The Return Part of Methods
         Methods Notes - Part 3 - Parameter & Return Value Combinations

         OOP - Enough For Now

         A "case study" full program through the lens of methods. (And another for HW)
         Here are three to download:
         Topic 4.3 - 10-Step Java - (Calculator)
         Topic 4.3 - The Oregon Trail
         Topic 4.3 - Insta Java Revolution

4.3.7 Define the operators =, ≠, <, <=, >, >=, mod, div.          
         video (YT)

4.3.8 Analyse the use of variables, constants and operators in algorithms.
         video (YT)

         A "case study" full program through the lens of data types and variables. (And another for HW)

4.3.8++ Java Jargon Jamboree

Wanna know how sout & psvm actually work? IntelliJ project

Spring 2021

7 classes:
Finish up looping, branching, arrays, and collections/lists via 4.3.9 - 4.3.12.
2 classes total of next 8: (Through April, in combo with "Coding Spring")
+ *quick* 4 1/2 class Computational Thinking (below)
(Maybe in combo with Insta Java Revolution consolidation of work above.)
6 classes
total of next 8:
"Coding Spring" (Through April, in combo with Computational Thinking)
So this shifts to "write" mode.

4 classes: (Starting April 29th planned, now into Delve & exam weeks)

Finish off computational thinking, in combo with 4.3.12, decomposition/abstraction.

Then back to arrays, and collections, in write mode, looking at algorithms with both.
i.e. lots of back and forth to/from collections.

So back to continue 4.3.10, 4.3.11, plus 4.3.13.

Plus maybe back to a "case study" or two program, perhaps another Sanfoundary program.

All of this, notched up at least to "read by writing" (case study) mode, if not fully "write" mode (the rest).

6 1/2 classes

Sorting/searching (3 classes)
+collections/OOP intro (remember no paper 2)
- last week in May/two weeks of June (but no May 26th, so 5 1/2 classes)

4.3.9 Construct algorithms using loops, branching.
         video (YT)
         Flow of Control
         If/Else Conditional Blocks & Compound Conditions
         Conditionals Code Example

         Miscellaneous SL Things 1
         video (YT) - loops
         The While Loop
         The For Loop
         Loop Within a Loop - also see 2D Arrays in Topic 5

         Looping & Branching Extras not needed, but "for the record" 4.3.9-X

         video: (YT) - full example

         A "case study" full program through the lens of if/else conditional blocks and loops.

4.3.9++ Hurray for Arrays!
         video (YT)
         Miscellaneous SL Things 2 (Math.random( ) & casting)
         For loops applied with arrays++
         (Note that 2D arrays are primarily for HL only.)


4.3.10 Describe the characteristics and applications of a collection.  (Includes 4.2.2)

>>>>> to come back to <<<<<

4.3.11 Construct algorithms using the access methods of a collection.
         video (YT)
         pdf of IB Collections Methods to use
         OurList IntelliJ class - TO COPY & MAKE USE OF, NOT TO UNDERSTAND
                                 - for use in IntelliJ to have an IB-like collections class to use

         Lists as collections++ (2021, come back after Coding Spring for second example)
         While loops applied with lists++ (2021, come back after Coding Spring)

4.3.12 Discuss the need for sub-programmes and collections within programmed solutions.

>>>>> to come back to <<<<<
         video (YT)- the need for sub procedures
         video (YT)- method calling & static
         video (YT)- return types and parameters

         Scope of Variables
         Code Example 1
Code Example 2

         Arrays & collections with parameters & return values++ >>>>> to add examples to <<<<<

(2021, stop here and transition to Coding Spring)

4.3.13 Construct algorithms using pre-defined sub-programmes, one-dimensional arrays and/or collections.
        video (YT)
        link to a program to be traced - a little tricky, so perhaps do it in class.

        IB Pseudocode Examples Document

        Semi-sophisticated Data Structure Algorithms
                average, pay, max positive number, mode, etc.++
        Parallel Arrays to OOP (possibly, or at least conceptually introduced)

Other Notes Needed or Potentially Needed for the IA Solution

        FileReader & FileWriter - for saving and opening files
        Exception Handling - Java Exceptions: NumberFormatException & ArithmeticException, try/catch blocks


Now is a good time to do OOP, or at some point with the rest of Topic 4 - not before, not after, but with, somehow.


Coding Spring

And it is at this point - or after, or in conjunction with 4.1 - that you just have to learn to program at a "write" level......

The best way (after an earlier "first spiral" in Year 1) is a Roseta Stone - "you, not me" - approach, and a "CODING AUGUST" (If OOP SL managed Year 1 Spring), or "CODING SPRING" (If OOP saved for Year 2) -like collection of exercises:

      1. CodingBat.com
      2. Tracing Exercises from Morelli textbook
      3. Laornual Year 1 & Year 2 Coding Challenges
      4. Insta Java Rev. Things to Do
      5. Past Paper 1 Questions
      6. Past Paper 2 Traces

Coding Resources

A. The first spiral: CodeHS.com, Karel Unit, and Java Mocha
B. The review spiral (beginning of Year 2): Insta Java Revolution Netbeans Project
D. This Topic 4, starting just below
C. Two other full curricula:
- The original Java Revolution - pre 2014 curriculum
- The "new" Java Revolution - 2014 curriculum


4.1 General principles (10 hours)

Thinking procedurally

4.1.1 Identify the procedure appropriate to solving a problem.
          video (YT) - What done in the video: procedure, pseudocode, reading in numbers, calculating an average

4.1.2 Evaluate whether the order in which activities are undertaken will result in the required outcome.
         video (YT) - order of mathematical operations, influence of changed order of lines

4.1.3 Explain the role of sub-procedures in solving a problem.
         video (YT) - making an averageThreeNumbers method

Thinking logically

4.1.4 Identify when decision-making is required in a specified situation.
         video (YT) - a decision making situation about higher grades

4.1.5 Identify the decisions required for the solution to a specified problem.
         video (YT) - a decision about continuing recording videos

4.1.6 Identify the condition associated with a given decision in a specified problem.
         video for both 4.1.6 & 4.1.7 (YT) - same program

4.1.7 Explain the relationship between the decisions and conditions of a system.
          - see video above

4.1.8 Deduce logical rules for real-world situations.          
         video (YT) - real world example: determinng DDoS attack - more compound conditions

Thinking ahead

----> Note that even though this section may seem trivial to someone who has planned lots of projects,
these assessment statements in isolation - not in conjunction with the IA solutio - students find relatively difficult.

4.1.9 Identify the inputs and outputs required in a solution.
         video (YT) - thinking about what input/output and functioning needed

4.1.10 Identify pre-planning in a suggested problem and solution.
         video (YT) - dividing stuff up into methods

4.1.11 Explain the need for pre-conditions when executing an algorithm.
         video (YT) - separating into methods, and pre-conditions

4.1.12 Outline the pre- and post-conditions to a specified problem.
         video (YT) - both logical and syntactical pre-conditions, post-conditions: what the method is to do

4.1.13 Identify exceptions that need to be considered in a specified problem solution.
         video (YT) - identifying two common error possibilities: divide by 0, input letters instead of numbers   

Thinking concurrently

4.1.14 Identify the parts of a solution that could be implemented concurrently.
         video (YT) - more of the same grades program
          - concept of Java Threads, but no new code

4.1.15 Describe how concurrent processing can be used to solve a problem.
         video (YT) - basically re-hash of previous video thoughts

4.1.16 Evaluate the decision to use concurrent processing in solving a problem.
         video (YT) - same program

Thinking abstractly

4.1.17 Identify examples of abstraction.
         video (YT) - same program, looked at as a complex situation broken down into simpler, abstract, parts

4.1.18 Explain why abstraction is required in the derivation of computational solutions for a specified situation.          
         video (YT) - sheep & cows OOP program to demonstrate abstraction
***But this one video is really much more about OOP, not about abstraction.
For now, for a video on actual abstration principles, try this one from YouTube.

4.1.19 Construct an abstraction from a specified situation.          
         video (YT) - sheep & cow program again: discussion of how it could be even more complex, requiring even more abstraction ***But again more of a focus on OOP than abstraction

4.1.20 Distinguish between a real-world entity and its abstraction.          
         video (YT) - three sheep...

4.2 Connecting computational thinking and program design (22 hours)

The focus of this topic is how an understanding of programming languages enhances the students’ understanding of computational thinking and provides them with opportunities for practical, hands-on experience of applying computational thinking to practical outcomes.

In externally assessed components questions will be presented using flow charts and/or pseudocode as outlined in the approved notation sheet. Answers will only be required in pseudocode.

Students must be given the opportunity to convert algorithms into working code that is executed and tested.
Working code will not be assessed in the externally assessed components.

4.2.1 Describe the characteristics of standard algorithms on linear arrays. <<<<---------------

--> Be sure to look at the actual 4.2.1 assessment statement immediately ABOVE.)


Linear/Sequential Search

Binary Search


AlgoRythmics Videos - Great intro...Oooh yeah... Hungarian Shell Sort's my boot-slapin' fav.
Sorting Algorithms Animations - not just intro, important for comparisons
Quicksort Animation - To give an idea of the potential sophistication of sorts.

Also, review/do nested loops, either from past paper questions or other examples.

Bubble Sort

Selection Sort (see Sorting notes link above)

Plus Full Netbeans sort and binary search (of ints) from class
Having done int sort and searches, do so with Strings - but NOT booleans.

----> Best is to leave the rest of Topic 4 to be done in conjunction with Past Paper review. <-----


4.2.2 Outline the standard operations of collections. (Included in 4.3.10 above.)

4.2.3 Discuss an algorithm to solve a specific problem.

4.2.4 Analyse an algorithm presented as a flow chart.

4.2.5 Analyse an algorithm presented as pseudocode.

4.2.6 Construct pseudocode to represent an algorithm.

4.2.7 Suggest suitable algorithms to solve a specific problem.

4.2.8 Deduce the efficiency of an algorithm in the context of its use.

4.2.9 Determine the number of times a step in an algorithm will be performed for given input data.

(And one of the biggest things with what follows is simply to walk away with a clear idea of what algorithms and pseudocode are.)

Plus JSR GUI Intro Unit at some point just before the IA Solution

This is where the basics of GUI can be introduced; the assumption is it will make OOP a bit easier to "visualize".
Basic Multi-tab Application Sample Form
Button Groups and Combo Boxes
And a possible good idea to here do a parallel array/ArrayList example or two as a good segue to OOP