Introduction to Program Design and Concepts

CSCE-121-{525,526,527,528}
Texas A&M University, Fall 2017

Instructor

Michael R. Nowak
Graduate Assistant Lecturer
Email: mnowak1[at]illinois[dot]edu
Office hours: Schedule an appointment

Teaching Assistants

Sharmistha Maity
Sections: 525, 526, 527
Email: smaity93[at]tamu.edu
Office: RDMC-021
Office Hours: W 12:30-14:30
Habib Baig
Sections: 528
Email: habib_baig.tamu[at]tamu.edu
Office: RDMC-021
Office Hours: F 16:00-18:00
Sanjib Baral
Office: RDMC-021
Office Hours: TR 16:00-17:00
Savinay Narendra
Office: RDMC-021
Office Hours: MW 10:10-11:10

* You can visit the office hours of any TA associated with this course (those listed above) to ask questions about the course work. For course specific questions (including grading), please visit the TA associated with your lab section.

Peer Teachers

Alyssa Valdez
Sections: 527
Gabriel Stella
Sections: 528
Haley Hutson
Sections: 526
Kylan Snyder
Sections: 527
Lauren Kleckner
Sections: 526
Robert Hodge
Sections: 525, 528
Samantha Ray
Sections: 525

Homework

  • Temperature Queries
    • Design Due: Tuesday, November 21, 2017
    • Code Due: Wednesday, December 6, 2017
  • Store Backend (Part 2)
    • Design Due: Sunday, November 12, 2017
    • Code Due: Friday, November 17, 2017
  • Store Backend (Part 1)
    • Design Due: Sunday, October 29, 2017
    • Code Due: Friday, November 10, 2017
  • Palindromes
    • Design Due: Sunday, October 22, 2017
    • Code Due: Saturday, October 28, 2017
  • Mountain Paths (Part 2)
    • Design Due: Sunday, October 15, 2017
    • Code Due: Saturday, October 28, 2017
  • Mountain Paths (Part 1)
    • Design Due: Sunday, October 8, 2017
    • Code Due: Friday, October 13, 2017
  • Bulls & Cows (Part 2)
    • Design Due: Sunday, September 24, 2017
    • Code Due: Friday, September 29, 2017
  • Bulls & Cows (Part 1)
    • Design Due: Sunday, September 17, 2017
    • Code Due: Friday, September 22, 2017
  • Quadratic Equation Solver
    • Design Due: Sunday, September 10, 2017
    • Code Due: Friday, September 15, 2017
  • Annual Growth
    • Code Due: Sunday, September 10, 2017

Schedule

Week Date Lecture Lab Reading Notes
1 Aug-29 Cancelled Cancelled - -
1 Aug-31 Course introduction
Computer organization (S)
  • Hardware
    • Central processing unit (CPU)
    • Instruction sets
    • Memory
    • I/O devices
  • Software
  • Machine language
  • Assembly language
  • Higher-level languages
  • C++ compilation
Software development process (S)
  • Analysis
  • Design
  • Implementation
  • Repeat
Analysis and design (S)
  • Quadratic equation solver
  1. Claim your computer science and engineering (cse) accounts
  2. Connecting to the departmental servers in lab
  3. Navigating the command line interface
  4. Flowcharts and pseudocode
Syllabus
Zybooks: chpt. 1
Stroustrup: chpt. 1 (skim), 4.1-4.2, 6.1-6.2
Zybook chpt. 1 all participation activities required (due Sep. 05 at noon)
2 Sep-05 Data representation (S)
  • Binary number system
    • Motivation for study
    • Binary numbers and modern computers
    • What is a positional number system?
    • The binary number system
    • Binary to decimal conversion
    • Decimal to binary conversion
    • Binary addition
  • Data representation in the computer
    • Integral numbers
    • Floating-point numbers
    • Character data
  1. Creating and editing source files in your h:drive using notepad++ in lab; compiling those source files on build.tamu.edu through putty
  2. Writing and compiling your first program
  3. Compiling C++ code through the command line interface
  4. Working on the departmental servers from home
  5. Creating and modifying documents in your h:drive using the VI line editor (optional)
  6. Working offline on your personal computer at home (optional)
Zybooks: chpts. 2-3
Stroustrup: chpt. 2, A.1, A.17, 24.2
Zybook chpts. 2-3 all activities (participation and challenge) required (due Sep. 05 at noon)
2 Sep-07 Objects, types, and values (S)
  • Motivation for study
  • Primitive built-in types
    • Boolean
    • Characters
    • Integers
    • Floating-point numbers
  • Variables
    • Names
    • Addresses
    • Types
    • Value
    • Lifetime
    • Scope
  • Declarations
  • Assignment
Type safety (S)
  • Type checking
  • Compatible types
  • Type errors
  • Strongly typed languages
  • Strong typing vs. weak typing
  • Static type checking vs. dynamic type checking
  • Type safety
  1. Submitting to vocareum for autograding
  2. Data representation
Zybook: chpts. 4-5
Stroustrup: chpt. 3, A.2, A.4, B.9.1
Zybook chpts. 4-5 all activities (participation and challenge) required (due Sep. 07 at noon)
3 Sep-12 Expressions and statements (S)
  • Tokens
  • Statements
  • Expressions
  • Grammars
  • Expressions
    • Basic concepts
    • Grouping operators and operands
    • Precedence
    • Associativity
    • Arithmetic operators
    • Logical and relational operators
  • Statements
    • Simple statements
    • Null statements
    • Compound statements
    • Conditional statements
    • Iterative statements
Type conversions (S)
  • Type conversions
    • Narrowing conversions
    • Widening conversions
    • Widening conversions vs. narrowing conversions
  • Coercion in expressions
    • Implicit type conversion
  • Casting in expressions
    • Explicit type conversion
  • Safe type conversions
  • Unsafe type conversions
  • Errors in expressions
Memory diagrams (S)
  1. Collaborative editor
  2. Coin maker
Zybook: chpts. 6-8
Stroustrup: chpt. 4, A.5, A.6 (skim), B.9.2, B.9.6
Solution: Coin maker
Zybook chpts. 6-8 all activities (participation and challenge) required (due Sep. 12 at noon)
3 Sep-14 Compound types, compound data (S)
  • Review
    • Basic terminology (types)
    • Types
    • Declarations
  • Compound types
    • Definition
    • References
    • Pointers
    • Arrays
    • Arrays and pointers
  • Compound data
    • std::vector
Errors and exceptions (S)
  • Functions (brief introduction)
  • Errors
    • Sources of errors
    • Expectations of your programs
    • The different kinds of errors
  • Compile-time errors
    • Syntax errors
    • Type errors
  • Link-time errors
  • Run-time errors
    • Detected by the computer
    • Detected by a library
    • Detected by user-code
  • Logic errors
  • Handling non-local errors at run-time
    • Caller deals with the error
    • Callee deals with the error
    • Error reporting
  • Exceptions
    • Throwing an exception
    • Handling exceptions
      • Try-block
      • Exception handlers
  1. Operators
  2. STL vector
  3. STL random number generators
Zybook: chpts. 9-11
Stroustrup: chpt. 5, A.8, A.11, A.14, B.2.1, B.8.2
Zybook chpts. 9-11 all activities (participation and challenge) required (due Sep. 14 at noon)
4 Sep-19 Debugging (S)
  • What not to do
  • What to do
    • Always write readable code
    • Get your program to compile
    • Verify that your program works
Search (S)
  • Linear search
  • Binary search
Sorting (S)
  • Selection sort
  1. Decimal to base-b conversion
Zybook: chpts. 12-13
Stroustrup: chpt. 10
Solution: Decimal to base-b conversion
Zybook chpts. 12-13 all activities (participation and challenge) required (due Sep. 19 at noon)
4 Sep-21 I/O streams (S)
  • Input & output
  • The stream model
  • The I/O classes
  • File I/O
  • I/O error handling
Customizing I/O (S)
  • Output formats
  • Formatting output
  • Output fields
  • Line-oriented input
  • Character-oriented input
  1. Debugging
Zybook: chpts. 14-15
Stroustrup: chpt. 11
Zybook chpts. 14-15 all activities (participation and challenge) required (due Sep. 21 at noon)
5 Sep-26 Announced quiz (week 2 material)
Function basics (S)
  • Function declarations
  • Function definitions
  • Declarations and definitions
  • Why both declarations and definitions?
  • Write function declarations in a header file
  • Write function definitions in a source file
  • Using functions defined in other source files
  • Separate compilation
  • Executing a function
  • Writing a function
  • Calling a function
  • Why functions?
Functions and the call stack (S)
  • Anatomy of a program in memory
  • The stack
  • Where's my program code stored?
  1. Inserting a line-break after a specified number of characters in an std::string, without word-break
Zybook: chpts. 16-17
Stroustrup: 8.1-8.4
Solution: Inserting a line-break after a specified number of characters in an std::string, without word-break
Zybook chpts. 16-17 all activities (participation and challenge) required (due Sep. 26 at noon)
5 Sep-28 Announced quiz (week 2-3 material)
Function argument passing (S)
  • Passing arguments by value
  • Passing arguments by reference
    • Using references to avoid copies
    • Using references to “return” multiple values
  • Passing arguments by constant reference
  • Guidance for passing arguments
  • Functions that return a value
    • How values are returned
    • Never return a reference or pointer to a local variable
Function overloading (ad hoc polymorphism) (S)
  • Defining overloaded functions
  • Calling an overloaded function
  • Overloading guidance
  1. Hadamard matrix
Zybook: chpts. 18-19
Stroustrup: 8.5-8.7 (skip 8.5.8)
Solution: Hadamard matrix
Zybook chpts. 18-19 all activities (participation and challenge) required (due Sep. 28 at noon)
6 Oct-03 Announced quiz (week 2-4 material)
Recursive functions (S)
  • Basics of recursion
  • Writing a recursive function
  • Recursive functions and the call stack
  • Recursion vs. iteration
  1. Utility functions
Review previously assigned readings Exam 1 material through today.
6 Oct-05 Exam 1 If you're having trouble understanding pass-by-value vs. pass-by-reference, go through my pass-by-value lab and my pass-by-reference labs prior to the exam; practice with compound data, check out vector stats lab; input validation, check this out. Review videos: stair example, input validation example, functions and exceptions example Code from review videos: Stairs.cpp, Stairs.InputValidation.cpp, functions and exceptions code1, functions and exceptions code2, functions and exceptions code3
7 Oct-10 Dynamic memory (S)
  • Allocation of memory to variables
  • Dynamically allocated objects
    • Allocation of dynamic memory
    • Accessing a dynamically created object
    • Deallocation of dynamic memory
    • Memory leaks
    • Dangling pointers
    • Corrupted heap
Resizable int array example
  1. Draw trees for recursive function calls; identify recursive and base cases
  2. Exceptions with functions
Zybook: chpts. 20-21
Watch: default arguments, recursive maze solver - analysis, recursive maze solver - design, recursive maze solver - design2, recursive maze solver - design3, recursive maze solver - implementation1, recursive maze solver - implementation2
Zybook chpts. 20-21 all activities (participation and challenge) required (due Oct. 10 at noon), default-argument-prt1.cpp, default-argument-prt2.cpp, recursive maze solver skeleton code, recursive maze solver complete code
resizableIntArrayPtr.cpp, resizableIntArrayRef.cpp
7 Oct-12 Abstract data types (S)
  • What an abstract data type consists of:
    • An interface
    • The allowable behaviors
  • What the implementation of an abstract data type consists of:
    • An internal representation
    • A set of methods implementing the interface
    • A set of representation invariants
  • Emphasis that an abstract data type focuses on what attributes and operations over how to store and implement
  • Mathematical models of abstract data types
Programming paradigms (S)
  • Programming paradigms as styles of programming
    • Imperative programming
    • Declarative programming
    • Functional programming
  • Some terminology
    • Abstraction
    • Information hiding
    • Abstraction and information hiding
    • Encapsulation
  • Some programing paradigms in brief
    • Procedural programming
    • Modular programming
    • User-defined types
    • Object-oriented programming
    • Event-driven programming
    • Generic programming
  • Namespaces
  1. Pass-by-value
  2. Pass-by-reference
  3. Pass-by-const-reference
 
8 Oct-17 Mountain paths part 1 implementation
  1. Pointer/reference review
  get_int and get_word source code
8 Oct-19 User-defined types, classes and structs (S)
  • Motivation
  • What exactly is a class?
  • What exactly is an object?
  • Why classes
  • classes and structs
  • Writing a class
  • Why bother with the public/private distinction of members?
  • Data members, public or private?
  • Private data members; accessors and mutators
  • Defining member functions outside of the class
  • Using private member functions
  • Using const with member functions
  • Inline member functions
  • Implied attributes
  • Object initialization
  • Constructors: default and parameterized
  • Destructors
  • What makes a good interface?
  • Interfaces and helper functions
  • Helper functions
  1. Dynamically allocated objects
Zybook: chpts. 22-23
Stroustrup: 9.1-9.5
Zybook chpts. 22-23 all activities (participation and challenge) required (due Oct. 19 at noon)
9 Oct-24 Finish-up user-defined types, classes and structs
Dynamic memory and user-defined types (constructed through classes) (S)
  • Writing a dynamic int array class
  • Copy challenges when dynamic memory presents in classes
  • Shallow copy vs. deep copy
  • Rule of three: copy constructor, copy assignment operator, and destructor should be written for all classes containing dynamically allocated data members
  • Copy assignment operator vs. copy constructor
  1. Class attributes, methods, getters & setters
  2. Class attributes: set-once
  3. Class constructors
Stroustrup: 9.6-9.8
Watch: Return by reference example, multiple constructor example
Return by reference example - skeleton code, return by reference example - final code, multiple constructor example - skeleton code, multiple constructor example - final code
9 Oct-26 Operator overloading and user-defined types (constructed through classes) (S)
  • Basic concepts
  • Calling an overloaded operator (non-member)
  • Calling an overloaded operator (member)
  • Member vs. non-member implementation of overloaded operators
  • Overloading
    • operator=
    • operator+=
    • operator-- (prefix)
    • operator-- (postfix)
    • operator+
    • operator<<
  1. Dynamic array-backed stack
Zybook: chpts. 24-25
10 Oct-31 Dynamic structures and linked lists (S)
  • Dynamic structures as an alternative to arrays
  • Linked list vs. array
  • Singly linked list
    • Properties
    • Common operations
    • A reasonable interface
    • Constructors
    • insert_front
    • Traversal of a linked list
    • insert_back
    • Destructor
  1. operator== overloading
  2. operator+= overloading
  3. operator<< overloading
   
10 Nov-02 Finish-up dynamic structures and linked lists
Singly linked list implementation (in part)
  1. Doubly linked list pt1
  Singly linked list skeleton code
11 Nov-07 Review
  1. Doubly linked list pt2
   
11 Nov-09 Exam 2 Labs canceled    
12 Nov-14 Inheritance (S)
  1. Binary search trees
Zybook: chpts. 26-27 Zybook chpts. 26-27 all activities (participation and challenge) required (due Nov. 14 at noon)
12 Nov-16 Inclusion polymorphism (S)
  1. Employee inheritance scheme
   
13 Nov-21 Lecture will not meet; instead, watch the following example videos:
Inheritance example pt1
Inheritance example pt2
Inclusion polymorphism example
Lab will not meet.   Inheritance example pt1 code, inheritance example pt2 code Inclusion polymorphism example skeleton code, inclusion polymorphism example final code
13 Nov-23 No Lecture/Labs : Thanksgiving Break      
14 Nov-28 Parametric polymorphism (S)
  1. Inclusion polymorphism bank account
   
14 Nov-30 STL intro and model (S)
  1. Generic linked list
Zybook: chpts. 28-29 Zybook chpts. 28-29 all activities (participation and challenge) required (due Nov. 30 at noon)
15 Dec-05 Review Workday    
- Dec-13 Final Exam at 15:30-17:30 in ETB-2005

Syllabus

It appears you don't have a pdf plugin for this browser. You can click here to download the pdf file.

Please click here to access the syllabus pdf file.