everything.study
COMP 2404

Introduction to Software Engineering

0.5 credit · Undergraduate

Introduction to object-oriented software development, with emphasis on the design and implementation of maintainable, reusable software. Topics include abstraction, modularity, encapsulation, and an introduction to design patterns.

Study notes

Independent, AI-drafted study guide · Public sources linked below · Added November 5, 2026

Independent C++ and object design guide aligned with the Fall 2026 outline. The C++ Core Guidelines supply supplementary modern practice; exact language versions and permitted library features depend on the course offering.

Cohesion, coupling, and class responsibilities

A maintainable design assigns coherent responsibilities to classes and makes their dependencies explicit. Cohesion describes how closely a component’s responsibilities belong together. Coupling describes what other components it must know about. A class that parses files, calculates tuition, sends email, and draws screens has several reasons to change, making isolated testing difficult. Split responsibilities around stable concepts rather than creating one class per line of code. Define invariants and public contracts before fields. A good abstraction lets a caller use a service without depending on its storage or internal sequence of steps.

References: COMP 2404 A/B — Fall 2026 course outline · Stroustrup and Sutter — C++ Core Guidelines

Constructors, destructors, and RAII

C++ object lifetime gives structure to resource management. A constructor establishes a valid state; a destructor releases owned resources. RAII connects a resource to an object’s lifetime so that normal scope exit and exception unwinding perform cleanup. Standard containers and smart pointers reduce manual ownership bookkeeping. A raw pointer may be a non-owning observer, so its presence alone does not say who deletes the object. Initialize members deliberately and respect their declaration order. A resource acquired halfway through a failing operation must still be managed so that failure does not leak it.

References: COMP 2404 A/B — Fall 2026 course outline · Stroustrup and Sutter — C++ Core Guidelines

Values, references, copying, and moving

Passing by value makes a parameter copy or move; passing by reference gives access to an existing object. A const reference permits observation without an ordinary copy and expresses a read-only interface through that reference. If a class owns a raw allocation, default memberwise copying can make two objects believe they own the same storage. Correct copy and move behavior must preserve ownership and invariants. Prefer members that already manage their resources, making ordinary compiler-generated behavior appropriate. A move transfers resources but still leaves the source in a valid state for its documented operations.

References: COMP 2404 A/B — Fall 2026 course outline · Stroustrup and Sutter — C++ Core Guidelines

Inheritance, virtual dispatch, and substitutability

Public inheritance expresses a behavioral subtype relationship. A derived object should honor expectations attached to the base interface. Virtual functions dispatch according to runtime type; a virtual destructor is needed when deleting derived objects through an appropriate polymorphic base pointer. Object slicing occurs when a derived value is copied into a base value, losing the derived portion. Composition is often clearer for reuse without an is-a relationship. Think about lifetime, ownership, and required behavior before drawing an inheritance hierarchy; a visually tidy diagram does not establish substitutability.

References: COMP 2404 A/B — Fall 2026 course outline · Stroustrup and Sutter — C++ Core Guidelines

UML, interfaces, and design patterns

A UML class diagram records concepts, relationships, multiplicity, and selected operations. Distinguish inheritance from association and ownership. A pattern names a recurring design approach with consequences, rather than a mandatory architecture. Strategy separates interchangeable behavior behind an interface; Observer propagates changes to interested listeners. Both introduce dependencies and lifetime questions. For example, a price calculator can accept a discount strategy instead of embedding every discount rule in one class. Tests can supply a deterministic strategy and verify calculations without configuring the entire application.

References: COMP 2404 A/B — Fall 2026 course outline · Stroustrup and Sutter — C++ Core Guidelines

Templates, containers, and a worked ownership example

Templates express operations over parameterized types, with requirements that must hold for those types. Standard containers provide tested representations and iterator-based access, but mutations can invalidate iterators or references according to each container’s rules. Consider an Order containing a vector of LineItem values. The vector owns its elements and releases their storage automatically; each LineItem can own its description as a string. Copying an Order then has ordinary value semantics without a hand-written destructor. This representation eliminates several manual allocation paths while leaving the Order’s business rules explicit.

class Order {
    std::vector<LineItem> items;
public:
    void add(LineItem item) { items.push_back(std::move(item)); }
    std::size_t size() const { return items.size(); }
};

References: COMP 2404 A/B — Fall 2026 course outline · Stroustrup and Sutter — C++ Core Guidelines

Practice & worked answers

Original exercises for this guide.

1. Why can two default-copied owning raw pointers cause trouble?

Show worked answer

Memberwise copying duplicates the address without duplicating ownership correctly. Both destructors may delete the same allocation. A value container or a deliberately implemented ownership policy avoids that ambiguity.

2. When is composition preferable to inheritance?

Show worked answer

When one component uses another or reuses behavior without satisfying a behavioral is-a relationship. Composition exposes the dependency without promising substitutability that the design cannot maintain.

3. Does const on a method guarantee the whole program cannot change related data?

Show worked answer

No. It constrains modification through that object’s ordinary members within the method, with language-specific exceptions and indirection considerations. External aliases and independently mutable objects still need careful reasoning.

Public notes & references

Course sources establish the scope above. Reference materials support the explanations; linked lecture notes and books remain with their authors.

Topics

Course catalogue

Prerequisites & course information

Precludes additional credit for SYSC 3010 , SYSC 3110 . Prerequisite(s): COMP 2401 with a minimum grade of C- . Lectures three hours a week, tutorial one and a half hours a week.

Sources