PROG2006

Advanced Programming

Spring

Gjøvik

English

Overview

4 candidates

Average grade

C

3.00

0.24

Pass rate

100%

5 points

Grade distribution
Average over time
Pass rate over time

About this 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 outcomes

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)

Teaching methods

  • 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.