Course - Advanced Programming - PROG2006
Advanced Programming
Assessments and mandatory activities may be changed until September 20th.
About
About the course
Course content
This course is for creators and builders who want both speed and correctness. You will write small but real programs in Rust (ownership, lifetimes, concurrency) and Haskell (algebraic data types, monads, purity), then profile and reason about why they work. We explore event-driven and reactive designs, immutability, lazy evaluation, memory management, and secure patterns for simple smart contracts. You will practice code reviews, property-based testing, and measured performance tuning. Modern AI tools are part of the workflow. You will learn when to trust them and how to verify results. Expect hands-on labs, tight feedback, and portfolio-ready artifacts.
Advanced Programming blends Rust and Haskell to develop robust mental models and production-grade habits. Using Rust’s ownership and lifetimes alongside Haskell’s types and purity, you will design and implement programs that are safe, fast, and explainable. Core topics include immutability, lazy computation, memory management, event-driven and reactive architectures, and practical concurrency patterns. We apply these to small, end-to-end tools and simple smart contracts with an emphasis on security and testing. Throughout, you will use generative AI and code-generation tools to accelerate work. You will explore with property-based tests, profiling, and code reviews to keep quality non-negotiable. While Rust and Haskell are the primary languages, we reference modern C++, Go, Java/Kotlin, Dart, and Solidity where it sharpens your intuition or broadens transferability. By the end, you will be able to justify design choices, measure performance instead of guessing, and ship maintainable and robust code.
Learning outcome
At the end of the course, students shall possess specialized knowledge and skills. The abbreviations: R Remember, U Understand, A Apply, An Analyze, E Evaluate, C Create.
Knowledge
- Define core concepts of multi-paradigm programming and differentiate key paradigms (OO/message-passing, functional, reactive, event-driven, defensive). (R,U)
- Explain the λ-calculus (syntax, β-reduction, Church encodings) and its link to functional programming. (U)
- Describe lazy evaluation and summarize its implications for semantics, time/space use, and runtime behavior. (U)
- Explain computation and memory-management concerns in sequential implementations of lazy languages (thunks, sharing, GC interactions). (U,An)
- Characterize event-driven and reactive models (streams, propagation, back-pressure) and contrast them with imperative control flow. (U,An)
- Explain concurrency models (threads/locks, futures/async, actors) and identify typical hazards (races, deadlocks, starvation). (U)
- Describe what smart contracts are, principal use cases, and platform constraints (execution model, fees, determinism). (U)
- Summarize strengths/limitations of generative AI and LLMs, including failure modes (hallucination, bias, prompt sensitivity) and safe-use boundaries. (U,An)
Skills
- Apply functional and reactive patterns (immutability, higher-order functions, composition, stream processing) to implement working programs. (A)
- Refactor code to use polymorphism (OO and functional) and generalize solutions via type abstraction. (A,An)
- Prove simple properties of functional programs using equational reasoning and induction; validate refactorings with laws (e.g., functor/applicative/monad laws where relevant). (An,E)
- Analyze time and space complexity of programs, including effects of laziness (sharing vs. duplication, strictness, asymptotics). (An)
- Design and implement multi-threaded/concurrent solutions; synchronize safely and diagnose/mitigate concurrency defects. (A,An,E)
- Develop and test simple smart contracts following basic security patterns; deploy to a test network and verify expected behavior. (A,C)
- Employ LLMs effectively: formulate precise prompts, constrain tools/calls, critique and verify outputs, and integrate results into a development workflow. (A,An,E)
- Optimize implementations for performance and memory footprint; instrument and interpret profiling data. (A,An,E)
- Engineer functional programs using algebraic data types, pattern matching, and monad stacks; evaluate alternatives. (C,E)
General competence
- Communicate design rationale and trade-offs clearly in code reviews, demos, and technical write-ups. (U,E)
- Select and justify an appropriate paradigm/architecture for a given problem and compare alternatives with evidence. (An,E)
- Collaborate in peer review (kodegjennomgang/medstudentvurdering) and give/receive actionable feedback. (A,E)
- Evaluate ethical, cybersecurity, and sustainability implications (e.g., energy/performance trade-offs, data handling, abuse risks) of design choices. (E)
- Contribute to decentralized systems by designing, implementing, and reviewing small smart-contract components aligned with security and governance constraints. (A,C)
- Synthesize idiomatic Rust and Haskell design patterns into maintainable small programs and defend the architecture in code reviews. (C,E)
Learning methods and activities
- Lectures
- Labs, group exercises
- Web-based learning (online reading resources, online lectures and video tutorials)
Note: subject to teachers' availability the lectures and teaching activities will be conducted on campus or will be conducted remotely.
Compulsory assignments
- Tasks
- Peer Reviews
Further on evaluation
Final exam (100%)
- Format: Written, digital, on campus, no aids.
- Grading: Letter grade (A-F).
- Resit: August resit. The department may change format to oral if needed.
Mandatory coursework (pass/fail, no resit)
- Tasks: 6-8 small weekly exercises. Must be submitted by the stated deadlines and approved.
- Peer Review: Active participation and completion of assigned peer-review activities (giving and receiving feedback as instructed).
- Exam admission: Both mandatory components must be approved to sit the final exam.
- Validity: Approved coursework is valid for the current exam term and for the next year course.
Academic integrity & conduct
- Collaboration rules and use of AI/code-generation tools will be specified per task.
Specific conditions
Admission to a programme of study is required:
Computer Science - Engineering (BIDATA)
Programming (BPROG)
Recommended previous knowledge
IDATG2102 Algorithmic Methods
Required previous knowledge
PROG1003 Object Oriented programming or IDATG2003 Programming 2
Course materials
The exact course material is subject to variations from year to year, based on the developments in programming languages, and new versions and updates to standards.
Example course material might contain, but not be limited, to the following:
- Haskell programming patterns
- Rust programming book
- Meta-programming, multi-threading patterns
- Advanced programming techniques
- Functional programming patterns: functors, monads, pure functions, higher-order functions
- Abstract data types (Haskell/Rust)
- Domain modeling using OO and Functional paradigms
- Languages used for examples: Haskell, Rust, C++, Python, Golang, Kotlin, Dart
- Reactive programming
- Advanced security techniques: defensive programming
Subject areas
- Computer Science