Week 1 - Class Overview and Introduction to Object Oriented Programming (OOP)
Learning objectives
- Design classes to represent data types in C++
- Construct and read UML class diagrams
- Write basic object oriented programs using common design principles
Suggested pacing
Day 1
- Review Syllabus and Course Tips
- OOP Intro
- Setup Qt Creator at home if you haven't
- Take the background survey in elearn
Day 2
- Constructors and Access Modifiers
- CPPLab - Objects Basics - Use
Day 3
- Headers, Documentation, and UML
- CPPLab - Objects Basics - Creation
Day 4
- Unit Testing
- Command Line Review
Online Activity Outline
Setup
Review the Syllabus in elearn. Then do the Background survey and Class Policies Quiz in eLearn.
If you did not take 161 at Chemeketa, you need to become familiar with how I have things set up and how to setup QtCreator. Go to the getting started with Qt Creator information in CS161 week 1. Follow the instructions to set up the development environment, and watch the relevant videos.
If you took CS161 in Java (or did AP CS A), you need to learn the basics of C++. The Resource Links include some valuable C++ information you can refer to.
OOP Basics
The history of modern programming is a quest for abstractions and structure that can be added to assembly code to make programmers more productive and less error prone. At some point, our code gets boiled down to machine instructions we could have written directly in assembly… but higher level languages allow us to more succinctly express ourselves and provide structure and limitations that prevent us from writing unintelligible and unmaintainable code.
Object Oriented Programming is a methodology for structuring programs that aims to make parts of a system accessible to each other through high level abstractions—so you don't have to know the ugly details of how a window paints itself to the screen, just that you can ask it to repaint itself by saying window.repaint(). It is the methodology of choice for most large projects involving large teams of developers all working on different parts of a system. There is nothing we can write using OOP we could not write without it, but it does make some jobs much easier.
Read Ch 9.1-9.5 and watch these videos:
Do the Objects Basics - Use CPPLab.
If you are not familiar with CPPLab, watch the video below. We will use it to get some of the small scale practice required to really understand what you are doing. Your username is the same as your my.chemeketa gmail username. Your starting password is "changeme"; you can change it on the login screen.
Headers and Information Hiding
Read Ch 9.6-9.7 and watch these videos:
Do the Objects Basics - Creation CPPLab.
Documentation and UML
Read 9.10-9.11 and watch these videos:
Unit Testing - Review
If you did not take CS161 here, begin by reviewing these three videos about unit testing. Otherwise, feel free to skip them.
Unit Testing - CS162
In CS162 there are some small differences to how we will do unit testing. This video talks about them:
The UnitTesting Guide has step by step instructions for setting up unit testing projects refer to it any time you need to set up a project.
Working on the Command Line - Review
In CS161 we learned how to use the command line. If you don't remember how to navigate on the command line and how to build your code by hand and run it, you should review this topic.
This Command Line Guide provides detailed instructions for how to open a command prompt, set up the path, navigate, and use g++. Using a QtCreator project, try building and running the code from the command prompt as shown in the video.
Assignment
Before you tackle this week's assignment, check out this video that review two other sample classes. The SimpleString shows a class that manages an array which is something you need to do in your first assignment.
Extra Info
OOP Introduction
New to object oriented programming? Having trouble seperating the details from the big picture? Try reading Don't fear the OOP.
Unit Testing & Test Driven Development
- This stack overflow thread has nice concise descriptions of what unit testing is and why it is good. Read the first three responses to the question.
- A thorough reading on test driven development.
- If you prefer learning via humorous slide shows, try this: Unit testing presentation (Press arrow keys to advance/backup)