ECE 150: Fundamentals of Programming

Douglas Wilhelm Harder and Werner Dietl

Estimated study time: 4 minutes

Table of contents

Sources and References

Equivalent UW courses — CS 135 (Designing Functional Programs), CS 136 (Elementary Algorithm Design and Data Abstraction), CS 115/116 (Introduction to Computer Science), CS 137 (Programming Principles)

Primary textbook — Bjarne Stroustrup, Programming: Principles and Practice Using C++, 2nd ed., Addison-Wesley, 2014.

Supplementary references — Stanley B. Lippman, Josée Lajoie, and Barbara E. Moo, C++ Primer, 5th ed., Addison-Wesley, 2012; Bjarne Stroustrup, The C++ Programming Language, 4th ed., Addison-Wesley, 2013; cppreference.com.

Equivalent UW Courses

ECE 150 is the first programming course for Electrical and Computer Engineering students, and its closest Math Faculty counterpart is CS 137, which is also taught in C++ and also aimed at engineers. Conceptually it straddles the full CS 135 and CS 136 sequence: the first half plays the role of CS 135 (values, control flow, functions, recursion, simple data) while the second half plays the role of CS 136 (pointers, dynamic memory, linked lists, classes, basic data structures). CS 115/116 is the lighter non-major version of the same CS 135/136 material in Racket and Python respectively, so ECE 150 covers far more ground at a faster pace than either. The best single analog is CS 137 plus the class and linked-list content normally carried by early CS 136.

What This Course Adds Beyond the Equivalents

Compared to the CS Faculty introduction, ECE 150 commits hard to low-level C++ from day one: pointers, addresses, the call stack, dynamic memory allocation, new and delete, and manual management of C-style arrays are central, not optional. It walks through the linked list as a hand-built dynamically allocated data structure, including destructors, tail pointers, and concatenation. It also pushes into inheritance and polymorphism using GUI widget and window classes, and frames exception handling through custom exception classes. What ECE 150 omits relative to CS 135 is the functional-design recipe, pattern-based recursion on algebraic data, and the Racket-first exposure to abstract data types. It does not develop the algorithmic or proof-style content of CS 136 beyond introductory searching and sorting, and it has essentially no overlap with the mathematical induction and correctness proofs that the CS stream emphasizes.

Topic Summary

Literals, variables, and control flow

The course starts with literal data, identifiers, local variable declaration and initialization, and the basic arithmetic, comparison, and logical operators. Conditional statements, for-loops and while-loops, and break statements are introduced together with the structured programming theorem as a justification for disciplined control flow.

Functions, testing, and debugging

Students learn to call library functions and to write their own functions with parameters and return values. Assertions, test writing, comments, and logging are presented as first-class tools, with a dedicated debugging week covering the systematic use of compilers and debuggers.

Numeric types and operators

Binary and hexadecimal representations are covered, along with integer data types, bitwise and bit-shift operators, floating-point types, and const variables. This section gives students the mental model of how numeric values are actually stored and manipulated by the machine.

References, arrays, and C-style strings

Reference variables, pass-by-reference, and aliases are introduced as the first form of indirection. Arrays are then laid out in the context of main memory and the call stack, and C-style null-terminated strings are used as a running example of pointer-based data.

Pointers and dynamic memory

Addresses and pointers are developed in depth, including dynamic allocation of single objects and arrays, the lifetime of dynamically allocated memory, common pointer hazards such as dangling references and leaks, and the use of const to protect pointer-accessed data.

Searching, sorting, and recursion

Linear search on arrays, binary search on sorted arrays, and the selection and insertion sort algorithms are implemented directly. Recursion is introduced both as a technique for mathematical functions and as a problem-solving strategy on arrays and numbers.

Classes and object-oriented design

Classes, namespaces, member functions, encapsulation, constructors, destructors, and assignment operators are developed on concrete examples. Operator overloading is added so that user-defined types integrate with the existing syntax of C++.

Dynamic data structures and inheritance

The course concludes by building a linked list with dynamic memory allocation, adding a size member and a tail pointer, and implementing list concatenation. Inheritance is then motivated through a base linked-list class and through GUI-style examples (window and widget classes), with polymorphism illustrated by exception classes.

Back to top