STUDY GUIDE · GKU 7
Programming languages study guide (Computer Science)
A programmer meets many languages in a career, and learns each faster by recognising the few ideas they are built from. The first part of this unit is about those ideas as a programmer uses them: classes, inheritance and dynamic dispatch; pure functions, closures and higher-order functions; how the object-oriented, functional and logic styles solve the same problem differently; iterators and operations on whole collections; type systems, generics and error handling; and the testing, debugging and style habits that keep programs readable. The second part opens the language implementation: how program text becomes a tree that other programs can read, how interpreters, compilers and optimisers walk that tree, how a running program lays out memory in text, data, heap and stack, how names are bound and parameters passed, and how garbage collectors reclaim memory. Each section opens with a quick-revision card, and worked examples run from easy to exam level.
Structured by the official ETEC subject standard for this topic: every listed topic and learning outcome, with formulas, figures and worked examples. The full sections are available to members in the app.
SKU 7.1 · Object-oriented programming and functional programming
Object-oriented concepts: encapsulation, inheritance, subtyping and dispatch
Designing a class hierarchy that reuses code through inheritance, keeps state behind an interface, and stays substitutable — with dynamic dispatch traced on a payroll example and the classic square–rectangle trap.
Functional programming: pure functions, immutability, closures and higher-order functions
Computing without changing state: pure functions and referential transparency, immutable data, functions as values that are passed, returned and composed, and closures as a way to encapsulate state without classes.
Comparing paradigms: inheritance, subtyping, functions and logic
How object-oriented, functional and logic programming express variation and reuse, the expression problem that separates the first two, and how a Prolog query is answered by unification and backtracking.
Operations on aggregates: iterators, generators and collection pipelines
Processing whole collections instead of indexing them: the iterator protocol in Python, Java and C++, map, filter and reduce, comprehensions and Java streams, and lazy evaluation with generators.
Type systems: checking, inference, generics, subtyping and error handling
What a type system guarantees and how it checks programs: static and dynamic, strong and weak typing, typing rules and inference, parametric and subtype polymorphism with variance, overloading, and exceptions as typed error handling.
Testing, debugging, documentation and style
The two outcomes of this unit that are about craft rather than a listed topic: testing and debugging small programs systematically, and writing them in a documented, consistent style that others can maintain.
SKU 7.2 · Program representation, language translation and execution
Programs as data: grammars, parse trees and abstract syntax trees
How program text is described by a context-free grammar, how precedence and associativity are built into the grammar, why a parse tree is reduced to an abstract syntax tree, and how programs read other programs through that tree.
Language processing: compilers, interpreters, optimisers and tools
The phases from source text to execution, the difference between compiling, interpreting, bytecode and JIT, which phase reports which error, and three small programs that process code: an interpreter, a constant-folding optimiser and a documentation generator.
Memory organisation: text, data, heap and stack; leaks and dangling pointers
Where a running program keeps its code and data, how a call becomes a stack frame, how deep recursion can go before the stack overflows, and how manual heap management produces leaks and dangling pointers.
Binding, scope, lifetime and parameter passing
When names get their meanings, how static and dynamic scope resolve them, how scope differs from lifetime, and how value, reference, value-result and name parameters are represented at run time and can give different answers.
Garbage collection: reference counting, tracing, copying and generations
How a language runtime finds memory that the program can no longer reach and reclaims it, what each classic collector costs, why reference counting leaks cycles, and why a collected language can still leak.
MORE COMPUTER SCIENCE GUIDES
- Algorithms, computability and complexity study guideGKU 1 · 11 sections
- Discrete structures study guideGKU 3 · 9 sections
- Software engineering study guideGKU 8 · 6 sections
- Computer architecture and organization study guideGKU 2 · 12 sections
- Operating systems study guideGKU 6 · 13 sections
- Information management: database systems and data modelling study guideGKU 4 · 10 sections
- Networking study guideGKU 5 · 10 sections