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

4.1 General principles (10 hours)

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.

****** JSR Note - the above note is really important. 4.1 should be incorporated when teaching programming. So for each of these, I'll try to include both a non-computer example, and project toward a (Java) example. *******


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, outputting
         New coding introduced: "breader" & "sout", float, parseFloat(), variable names, order of operations                                                 
         Additional Coding Notes: Console Input and Java Types
         Additional Coding Notes: More on Java Data Types

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
         - * / + -
         Additional Coding Notes Preview: Flow of Control

4.1.3 Explain the role of sub-procedures in solving a problem.
         video (YT) - making an averageThreeNumbers method
         - method/function declaration, and method/function calling
         Additional Coding Notes: Flow of Control
         Additional Coding Notes: Methods Introduction
         Additional Coding Notes: Methods Part 2 (and note this includes return types)

Thinking logically

4.1.4 Identify when decision-making is required in a specified situation.
         video (YT) - a decision making situation about higher grades
         - intro to return methods, intro to if/else conditional block

4.1.5 Identify the decisions required for the solution to a specified problem.
         video (YT) - a decision about continuing recording videos
          - boolean data type, int data type, compound conditions, ! for not

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
          - no new code

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
          - /*commenting*/, && and || (AND and OR)
         Additional Coding Notes: (Compound) Conditions

Thinking ahead

Big full OOP "Preview" Program: Pond Database - for use in describing what follows, but not for understanding code at this point

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

4.1.10 Identify pre-planning in a suggested problem and solution.
         video (YT) - dividing stuff up into methods
          - the need for static methods called from main

4.1.11 Explain the need for pre-conditions when executing an algorithm.
         video (YT) - separating into methods, and pre-conditions
          - scope explained & variables changed to global scope
         Additional Coding Notes: Scope of Variables

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
          - no new code

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
         - Java Exceptions: NumberFormatException & ArithmeticException, try/catch blocks
         Additional Coding Notes: Exception Handling

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
          - no new code

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

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
          - no new code

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 really much more about OOP, not about abstraction.
For now, for a video on actual abstration principles, try this one from YouTube.

          - Object Oriented Programming (OOP) "Foreshadowing"

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 focuse on OOP than abstraction

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


4.3 introduction to programming (13 hours)

Nature of programming languages

4.3.1 State the fundamental operations of a computer.         
         video (YT)
         Additional Coding Notes: FileReader & FileWriter (this is not fundamental storing/retrieving on a CPU, but it's a good place to introduce the concept of permanent storage)

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.

4.3.6 Define the terms: variable, constant, operator, object.
         video (YT)
Here is where it ***may*** make sense to look at method parameter passing, and return values - or wait until 4.3.12.****
And even a ***possible*** introduction (first spiral "exposure") to Object Oriented Programming

         (Additional Coding Notes: Methods Notes - Part 1 - Introduction)
         (Additional Coding Notes: Methods Notes - Part 2 - The Return Part)
         (Additional Coding Notes: Methods Notes - Part 3 - Parameter Passing)

         An OOP intro at this point, perhaps - a "first spiral" "exposure" (look up OOP-Exposure-Pond-Project.php)
**** Do have to be careful not to get too bogged down here with OOP - expose, sure, but then move on to

----------------> JSR Note: Now is a great time for tracing exercises, and also "find the errors" labs, among other programming assignments <--------------------

4.3.7 Define the operators =, ≠, <, <=, >, >=, mod, div.          
         video (YT)
         Additional Coding Notes: Miscellaneous SL Things

4.3.8 Analyse the use of variables, constants and operators in algorithms.
         video (YT)
         Additional Coding Notes: final CONSTANTS

****And this is where things change more than a bit... moving from a theoretical and "read" stage, to a distinctly "write" Construct stage.
So at this point, it may be a good idea to clean up, and test, the rest of the more theoretical, which follows - namely 4.3.10, and 4.3.12

4.3.9 Construct algorithms using loops, branching.
         Additional Coding Notes: Flow of Control (deja vu)
         video (YT) - branching
         Additional Coding Notes: Conditions & Compound Conditions
         Code Example 1
         Code Example 2
          video (YT) - loops
         Additional Coding Notes: The While Loop (Being sure to learn the while loop before the for loop)
         Additional Coding Notes: The For Loop
         Additional Coding Notes: The Do While Loop
         (see also Loop Within a Loop Notes)

         video: (YT)- full example

4.3.10 Describe the characteristics and applications of a collection.          
         video (YT)

         Do be sure to teach arrays the { } way before the [ ] way.
         Additional Coding Notes: Arrays
         Additional Coding Notes: 2D Arrays

----------------> JSR Note: Be sure to fit in more tracing exercises, and also "find the errors" labs, among other programming assignments <--------------------

4.3.11 Construct algorithms using the access methods of a collection.
         video (YT)

4.3.12 Discuss the need for sub-programmes and collections within programmed solutions.
         video (YT)- method calling & static (check order of these three)
         video (YT)- the need for sub procedures
         video (YT)- return types and parameters
(YT- which one?)
         Additional Coding Notes: Methods Notes - Part 1 - Introduction (possibly deja vu)
         Additional Coding Notes: Methods Notes - Part 2 - The Return Part
         Additional Coding Notes: Methods Notes - Part 3 - Parameter Passing
         Additional Coding Notes: Scope of Variables (deja vu)
         Code Example 1
Code Example 2

4.3.13 Construct algorithms using pre-defined sub-programmes, one-dimensional arrays and/or collections.
        video (YT)    

----------------> JSR Note: Time for more tracing exercises, and also "find the errors" labs, among other programming assignments <--------------------

In fact, here's a link to a program to be traced - a little tricky, so perhaps do it in class.


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. (JSR note: i.e. the "revolution approach!)

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. (JSR note: ***DO take a look at these two links.***)

JSR Note: ***But note that the pseudocode here, for instruction sake, will be almost Java; for teaching it makes no sense to introduce another way of showing algorithms. BUT, for exam preparation, the transition to the ALL CAPS etc. nature of the approved pseudocode will be necessary.

Students must be given the opportunity to convert algorithms into working code that is executed and tested. (JSR note: i.e. teach coding.)

Working code will not be assessed in the externally assessed components. (JSR note: i.e. not on Paper 1.)

4.2.1 Describe the characteristics of standard algorithms on linear arrays.

Suggested routine:

         Sorting Animation Links

         Sorting notes

         Searching Notes

         (Note and put in an appropriate place that if having already looked at polymorphism, sorts and searches can
         be done all with the same name, each version just taking in different types as parameters.)

         Full Netbeans sort and binary search (of ints) from class

         Having done int sort and searches, do so with Strings - but NOT booleans.

4.2.2 Outline the standard operations of collections.


JSR GUI Intro Unit

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

A good idea to here do a parallel array/ArrayList example or two as a good segue to OOP.


go to Stage E (In Topic OOP Option)

So now you move on to SL OOP (JSR Note: but be sure to not be a turkey and introduce a full OOP and/or GUI search etc.)

4.2.3 - 4.2.9 is saved for pre-programming-review




----> Alternatively - and arguably better anyway - this can just be briefly referred to along with doing past papers <-----


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

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.