TK Study

Software Engineering › Notes › Year 11 content (Programming fundamentals, OOP, Mechatronics)

Year 11 content (Programming fundamentals, OOP, Mechatronics)

Software development steps and algorithm design

Programming paradigms

Number systems, two's complement, characters

Data structures

Object-oriented concepts

Testing and code quality (Year 11)

Mechatronics: hardware, sensors, actuators, control

BEGIN FollowLine
    WHILE robot is on
        Read lightSensor
        IF lightSensor is DARK THEN
            Turn motor left
        ELSE
            Turn motor right
        ENDIF
    ENDWHILE
END FollowLine

Part 2. School notes (Canvas, 12SENX2) by syllabus dot point

Corrections are marked in the text. Anything not marked is the school wording.

Procedures and Functions

Functions

Functions are blocks of code that take inputs, perform a specific task and return a value. Its main purpose is to produce a value based on the inputs provided.

Procedures

Void functions are blocks of code that take inputs and perform a task but do not return a value. Its main purpose is to execute commands.

Errors

Syntax Error: Code violates the rules of the programming language

Logic Error: Code runs but doesn’t produce the expected output due to flawed logic

Runtime Error: Serious problem as the program is running due to incorrect assumptions

OOP, imperative, logic and functional Programmingc Paradigms

A paradigm is a way of programming thinking. It is a model or theoretical framework.

Imperative programming:

Code consists of a sequence of commands that change the state of a program.

It tells the computer "how" to perform a task by specifying a step-by-step process.

The focus is on changing variables and memory locations to achieve the desired outcome.

Example languages: C, Pascal

move_forward(10);
elevate_arm(90);

Object-oriented programming (OOP):

Focuses on organising code into "objects," representing real-world entities or abstract concepts.

Objects contain data (attributes) and behaviour (methods).

Example languages: Python, Java

import abc

class Animal(abc.ABC):
def init(self, name, species):
self._name = name # encapsulation
self._species = species

@abc.abstractmethod #abstraction
def make_sound(self):
pass

def get_info(self):
return f"{self._name} is a {self._species}."

class Dog(Animal): #Inheritance
def init(self, name, breed):
super().init(name, species="Dog")
self._breed = breed

def make_sound(self):
return "Woof!"

def get_info(self): #polymorphism
base_info = super().get_info()
return f"{base_info} It is a {self._breed} breed."

dog = Dog(“Daniel”,”dog”)
dog.get_info()

Logic programming:

Relies on logical relationships, rules and constraints. The program searches for a solution that satisfies these constraints.

It focuses on the "what" rather than the "how" and is mainly used for symbolic computing, artificial intelligence, and expert systems.

Example language: Prolog

% Facts
parent(john, mary).
parent(mary, susan).

% Rules
grandparent(X, Y) :- parent(X, Z), parent(Z, Y).

Functional programming (FP):

Treats computation as the evaluation of mathematical functions.

It avoids changing state and mutable data, emphasising immutability and using pure functions without side effects.

FP promotes more predictable code, is easier to test, and is less prone to bugs.

Example languages: Haskell

factorial :: Integer -> Integer
factorial 0 = 1
factorial n = n * factorial (n – 1)
Paradigm Strengths Weaknesses
Imperative Efficient
Close to the machine hardware
Relatable in real world
Difficult debugging
Limited abstraction
Necessity of order
Poor reusability
OOP High degree of modularity
Easily understood
Only benefits problems with the need for re-usable code and those that are not sequentially driven
Logic The system solves the problem, so the programming steps are kept to a minimum
Proving the validity of a given program is simple
Difficult to code complex programs
Functional Focus on high-level design
Flexible and reusable
Easier to test and debug
More memory usage
Less expertise and tools that support this paradigm

Compare procedural programming with OOP.

Procedural-Oriented Programming (POP) Object-Oriented Programming (OOP)
The program is divided into functions The program is divided into objects
Doesn't use Access Modifiers Makes use of Access Modifiers 'public', 'private', 'protected'
It is less secure It is more secure
Data can move freely from function to function within programs The object can move freely within member functions
It does not support inheritance It supports inheritance

Encapsulation

Encapsulation allows programmers to hide attributes within a class to promote data security. These attributes are typically hidden and only accessible and modifiable through well-defined interface methods (getter and setter methods). It organises the variables and methods within classes.

Inheritance

Inheritance allows classes to inherit attributes and methods from other classes. This enables a hierarchical structure of classes where child classes can reuse and extend the functionality of their parent class. The child class doesn’t have to redefine the attributes and methods of the parent classes to use them. The child class is a more specialised version of the parent class. Inheritance is an “is-a” relationship.

Polymorphism

Polymorphism is a concept that allows classes to behave in different ways without changing the interface in which they are used. Inheritance enables polymorphism, and polymorphism allows the redefinition of methods in inherited classes to perform a single action differently. This is also called method overriding.

Generalisation and Abstraction

Generalisation

Generalisation is finding common traits among various specific classes and creating a general class from these traits. It aims to reduce copied code and promote maintainability and reusability.

Abstraction

Abstraction is the action of hiding implementation details and focusing on the essential ideas of a class rather than the specifics. Generalisation typically uses abstraction to create generic classes.

When an abstracted class is created either through abstraction or generalisation, it cannot instantiate objects.

Stubs and Drivers

Stubs are placeholders for low-level functions that mimic the expected behaviours of these functions to allow top-down level integration testing.

Drivers are placeholders for top-level modules that integrate low-level functions, allowing bottom-up system testing.

Intrinsic Documentation – Code comments, inline documentation

Part 3. Where this has been examined (see ../../question_bank.md)

ID Marks Source Topic / type
hsc2025-q4 1 2025 HSC Optimisation (multiple choice)
hsc2025-q14 1 2025 HSC Data structures (dropdown (fill in blanks))
hsc2025-q17 3 2025 HSC Algorithm design (pseudocode)
hsc2025-q26 5 2025 HSC Design, construct and implement a solution (Python) (Python)
sample-q7 1 Sample Exam Python to pseudocode (multiple choice)
sample-q9 2 Sample Exam Algorithm design (guessing game) (drag into order (algorithm))
sample-q14 3 Sample Exam Algorithm design (subroutines) (pseudocode)
sample-q21a 1 Sample Exam 2D arrays (Python) (multiple choice (Python))
sample-q21b 5 Sample Exam Python: subroutines, lists, loops (Python (subroutines, 2D list))
fam-q8 3 Familiarisation Algorithm design (linear search) (pseudocode (fix algorithm))
fam-q13 6 Familiarisation Python: lists, loops, selection (Python)
sdd2021-q26 4 Old SDD (old syllabus) Algorithm design (guessing game) (short answer / extended)
sdd2021-q30 4 Old SDD (old syllabus) Algorithm design (string matching) (short answer / extended)
sdd2022-q30 5 Old SDD (old syllabus) Algorithm design (arrays) (short answer / extended)
sdd2023-q30 3 Old SDD (old syllabus) Algorithm design (menu) (short answer / extended)
sdd2024-q30 7 Old SDD (old syllabus) Algorithm design (random allocation); testing with stubs (short answer / extended)