Software Engineering › Notes › Year 11 content (Programming fundamentals, OOP, Mechatronics)
Year 11 content (Programming fundamentals, OOP, Mechatronics)
Software development steps and algorithm design
- Eight steps: Requirements definition, determining specifications, design, development, integration, testing and debugging, installation, maintenance.
- Standard algorithm features: Sequence (steps in order), selection (decisions), iteration (loops), and identifying the data that should be stored.
- Divide and conquer: Break a big problem into smaller sub-problems, solve each, and combine the results (e.g. binary search, merge sort, structure-chart modules).
- Backtracking: Try a choice, and if it leads to a dead end, step back and try the next option (e.g. maze solving, Sudoku).
- Top-down v bottom-up: Top-down: start with the whole problem and refine it into subroutines (structure chart). Bottom-up: build and test small components first, then combine them.
- Analysing an algorithm: Determine the inputs and outputs, the purpose, desk-check (trace with sample data), peer-check, and find how it connects to other subroutines or functions.
- Procedure v function: A procedure performs a task; a function returns a single value (RETURN).
- Online code collaboration tools: Platforms such as GitHub and GitLab allow sharing, version control, issue tracking, pull requests and review across a team.
Programming paradigms
- Imperative: Step-by-step commands that change state: control structures, variables, assignment statements, expressions and subroutines.
- Object-oriented (OOP): Organises code into objects created from classes, with attributes (data) and methods (behaviour); uses inheritance, polymorphism, encapsulation and message passing.
- Logic: Programs are facts and rules; the system infers answers (e.g. Prolog). You define and edit facts, create/edit/remove rules, and display the solution and the rules used.
- Functional: Programs are built from functions; call functions and use recursion; functions are first-class objects and collections; avoid changing state.
- Procedural v OOP: Procedural: a list of procedures acting on separate data; data and code are separate and data is often global. OOP: data and methods bundled in objects, better encapsulation, reuse through inheritance, easier to maintain large programs.
Number systems, two's complement, characters
- Binary: Base 2, digits 0 and 1. Place values 128 64 32 16 8 4 2 1. Example: 1011 = 8+2+1 = 11.
- Hexadecimal: Base 16, digits 0-9 and A-F (A=10 ... F=15). One hex digit = 4 binary bits. Example: 0xB3 = 1011 0011 = 179. Used because it is a compact way to write binary (colours #FF0000, memory addresses).
- Decimal to binary: Divide by 2 repeatedly and read remainders upward, or subtract place values. 13 = 1101.
- Two's complement: Represents signed integers. The leftmost bit is the sign (1 = negative). To negate: invert all bits and add 1. Example (8 bit): 5 = 00000101; invert = 11111010; add 1 = 11111011 = -5.
- Range: With n bits, two's complement runs from -2^(n-1) to 2^(n-1) - 1 (8 bits: -128 to +127).
- Adding negatives: Subtraction is done as adding the two's complement; ignore any carry out of the leftmost bit.
- ASCII and Unicode: Characters are stored as binary codes. ASCII is 7/8 bit (128/256 characters); Unicode covers all languages and symbols. In Python: ord('A') = 65, chr(65) = 'A'. Knowing the codes lets you change case (lowercase = uppercase + 32) or do simple encryption (shift the code).
- Standard data types: char and string, Boolean, real, single-precision floating point (32 bits), integer, date and time.
Data structures
- Array: A fixed-size, ordered collection of items of the same type, accessed by index (starts at 0 in Python). Multidimensional: a grid or table (list of lists).
- List: In Python an ordered, changeable collection. my_list.append(x), len(my_list).
- Record: A group of related fields of possibly different types about one thing (e.g. a student: name, ID, mark). In Python: a class or dictionary.
- Sequential file: Records stored one after another and read in order from start to end (e.g. a text file read line by line).
- Tree: Hierarchical nodes with a root and child nodes (e.g. folder structure, decision tree, binary search tree).
- Stack: Last in, first out (LIFO): push to add, pop to remove the top (undo, function calls).
- Queue: First in, first out (FIFO).
- Hash table: Stores key-value pairs; a hash function turns the key into a location for very fast lookup. Python dictionary.
Object-oriented concepts
- Class: A blueprint (template) defining the attributes and methods of a kind of object.
- Object: An instance of a class with its own attribute values.
- Attribute: A variable that belongs to an object (data/state). Method :: A function that belongs to a class (behaviour).
- Encapsulation: Bundling data and the methods that work on it inside a class and restricting direct access to the data (private attributes with getters/setters), so the data stays valid and secure.
- Abstraction: Hiding complex implementation detail and exposing only what is needed (a user calls account.deposit() without knowing how it works).
- Inheritance: A subclass (child) takes the attributes and methods of a superclass (parent) and can add or change them, giving code reuse. Models an 'is-a' relationship (Student is a Person).
- Generalisation: Pulling shared features of several classes up into a common superclass (Student and Parent generalised as Person).
- Polymorphism: Different classes provide their own version of the same method name, so the same call behaves differently depending on the object (speak() for Dog and Cat).
- Message passing: Objects communicate by calling each other's methods (sending a message with parameters, getting a return value).
- Facade pattern: A simple class/interface that hides a complex set of subsystem classes behind one easy interface.
- Features supporting collaboration: Consistency (naming and style), code commenting, version control, and feedback (code review).
- Good OOP code (spec): Clear and uncluttered mainline; one logical task per subroutine; use of stubs; suitable control and data structures; ease of maintenance; version control; regular backup.
Testing and code quality (Year 11)
- Levels: Unit, subsystem and system testing.
- Box testing: Black box (inputs/outputs only), white box (internal code and paths), grey box (partial knowledge).
- Quality assurance: Processes to make sure the software meets quality criteria: functionality, performance, readability of code and quality of documentation.
- Test data: Boundary values, path coverage, faulty and abnormal data.
- Errors: Syntax (language rules broken), logic (wrong result), runtime (fails while running).
- Optimisation: Improve efficiency in speed or memory (better algorithm, less repeated work, suitable data structures).
Mechatronics: hardware, sensors, actuators, control
- Mechatronic system: Combines mechanical engineering, electronics and software control (robots, automatic doors, drones, 3D printers, car cruise control, prosthetics).
- Microcontroller and CPU: A microcontroller is a small computer on one chip (CPU, memory, input/output pins) dedicated to controlling a device; it executes program instructions using the CPU's instruction set.
- Instruction set and opcodes: The instruction set is the list of commands the CPU understands; each instruction has an opcode (the operation) and operands. The instruction set limits what code can do and how efficient it is.
- Registers: Fast storage inside the CPU: address registers hold memory addresses; data registers hold the values being processed.
- Sensor: Input device that detects the environment and sends data (motion sensor, light level sensor, temperature, ultrasonic distance).
- Actuator: Output device that causes movement or action (motors, servos, hydraulic actuators).
- End effector / manipulator: The device at the end of a robotic arm that interacts with the world (robotic gripper, welder, suction cup).
- Open-loop control: Output is set without checking the result (a timer-based sprinkler). Simple but cannot correct errors.
- Closed-loop control: Sensors feed back the result and the algorithm adjusts the output to reach a target (thermostat, cruise control, line-following robot). Feedback makes it accurate.
- Autonomous control: The system senses, decides and acts without human input (self-driving vehicle, robot vacuum) using sensor data and decision algorithms.
- Degrees of freedom and motion constraints: Degrees of freedom = the independent directions/axes a part can move; motion constraints = limits on movement (range, speed, obstacles) the code must respect.
- Power and wiring: Choose battery/power for each component's voltage and current; wiring diagrams use standard symbols (resistor, capacitor, diode, LED, switch, motor, voltage source) and show data and power connections; label other components clearly.
- Data in mechatronics: Sensor data, diagnostic data (system health) and data used for optimisation (tuning performance).
- Disability design: Specialist requirements (e.g. prosthetics or assistive devices need comfort, safety, intuitive control, adjustability, reliability).
- Testing: Create unit tests to check the effectiveness and repeatability of each component's control algorithm; use simulations and prototypes before the real build.
- Control loop (pseudocode):
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) |