CS 3505: Software Practice II
Instructor: Dr. David E. Johnson
School of Computing
Course Overview
Part 1
Course Overview and Mechanics
What Is Software Engineering?
• Engineering is about process
– Requirements in
– Product out
• Engineering is concerned with
– Safety
– Reliability
– Quality
– Project success
• Sounds boring?
Prior Software Engineering
• Previous software
engineering
processes tried to
remove human
variability and
inventiveness from
the equation
– Programmers in
cubicles
Golden Age for Programmers
• Modern approaches
emphasize
– Personal investment
in results
– Sharing of ideas
– Realistic goals
Topics in 3505
1. Get comfortable with C++
– Languages are evolving together
• C++ is seeing continued changes
– We will cover core C++ and look at C++11/14/17/20
features in smaller levels of detail
• C++ is still an important language
– search C++ jobs
– Why have different languages?
Topics in 3505
1. Get comfortable with C++
– Languages are evolving together
• C++ is seeing continued changes
– We will cover core C++ and look at C++11/14/17/20
features in smaller levels of detail
– Why have different languages?
• different ways of expressing different ideas
• formal vs informal
• speed
• ecosystems attached to the language
Topics
2. Tool-chains
– Software development requires a huge
number of tools
– The better you are at them the more efficient
you are as a developer
– Example tool-chains
• Visual Studio + GitHub
• emacs/terminal/[c]make/doxygen/ssh/git
Topics
• I plan on covering
– Terminal/text-editor – Versioning tools
development
– Testing tools
• g++/makefiles
– Planning tools
– Medium-weight IDEs
• QT user interface
– Documentation tools
development – Group work tools
environment
– Code style
– Coding in Docker
instances
Topics
3. Development in larger systems
– Use large code bases (libraries)
– Develop within large code bases
• Skills in “fitting in” with existing code
• Google C++ code style is a fascinating read
– Has pros and cons of different approaches
– For example, what is the favorite way in Java and many
modern languages to deal with errors?
– What is Google’s take on this issue?
Topics
4. Small team development
– Using and developing software requirements
– Architecting systems
– Communicating design via UML (Unified
Modeling Language)
– Evolving and maintaining code
– Communication and interaction on a team
– Code review
– Teamwork is required for this course!
• Mechanisms to account for disappearing
teammates
Topics
– Small-team methodologies
• Traditional approaches
– Heavy planning
• Agile approaches
– Different versions of Agile
– Tools to support Agile development
– Buying into the Agile mindset
• Lab sessions will eventually evolve into agile
meeting sessions
Topics
5. Idioms and Design Patterns
– Many issues show up over and over
– Solutions have been collected
• small ones are idioms
• bigger ones are design patterns
• biggest ones are frameworks
– Many topics in C++ will be introduced in that
context
Coursework
• Largely weekly assignments
– Anticipate significant design, coding, and testing
– Expectation is that you are maturing as a
programmer
• Less hand-holding
– Not step-by-step instructions on how to compile a project in an
IDE
• Be brave, independent, and determined
– Written assignments
• Quality communication expected
– Review of work by peers
• Learn to recognize good code and comment on other code
Labs
• Lab sections
– Loosely structured with TA help
• My hope is that people will come at the start of
scheduled sessions, find groups of people to work
through them, and get help from TA as needed.
– Additional technical material and practice
– Do online exercise to get credit
Tests
• Exams
– A single midterm
– No final
• that exam time will be used for something related
to the final project.
Turning in Assignments
• Late work
– 10% off for 0-23:59:59 late, 0 credit for 24 hours late.
– If you plan on always submitting with 1 minute to
spare, you are planning on failing
• Stuff happens that is difficult to recover from in one minute
– I will consider documented emergencies
• This is 911 or hospital kind of stuff
• Not a sudden craving for Starbucks
Texts
• Largely online resources
– Read the posted resources
Cheating
• The School of Computing has a strong
academic misconduct policy
• Please read
– https://handbook.cs.utah.edu/2021-2022/Acad
emics/misconduct.php
Cheating
• Some assignments are individual
• With other students
– May discuss concepts but not share code
– May help with tools, but not with code
• Teams
– Not share code with other teams
– Not use old CS3505 projects
– Internet code must be snippets and documented
– Freeloading off team and misrepresenting your
involvement is misconduct
– Keep code off the forums
Always allowed collaboration
• In labs
– Work together on instructions, not just copy
answers
Course Communication
• Click on the Piazza link on left menu bar in
Canvas
– make sure your U email goes to some place
you will read it
– You can contact
• me
• instructors
• everyone
• Email me directly if you want (Piazza
generally better)
[email protected] My Office
• 3146 MEB ph# 585-1726
David
Johnson
A Little About Me
• PhD from University of Utah
• Research
– Mostly graphics and robotics
• Teach
– CS 1410 (Now 1400/10 or 1420)
– Programming for Engineers
– Virtual Reality
– Robot Motion Planning
– Software Practice II
– COMP Python courses
My Research Interests
Geometric algorithms and their applications
Current Directions
Augmented Reality Science Labs
Magnetic Interfaces
Outreach
Summer camps (>500 kids each summer)
Questions or Concerns?
Let’s Get Technical
• What machines will we use?
– A little history
• A few years ago we did remote access to CADE Linux
• Then I did a Linux VM
– It was good, but M1 Macs don’t support x86 virtualization
• Two semesters ago I did a bit of a free-for-all
– And it was a bit of a mess
• Last semester we did some Docker linux instances
– Seemed nice
– Matches a lot of modern code development styles
– Attach an editor to a possibly remote instance
– Share instances to keep environment consistent
C++ History
• C was developed in the • New C++ releases
1970’s • Referred to as
– Dennis Ritchie – C++03, C++11, C++14
– Widespread adoption – Added higher-level
• Efficient with resources data structures
• Often the first choice on
– Modern language
new architectures,
embedded systems features
• Lambda functions
• C++ (Bjarne Stroustrup) • Managed memory
– started extending in ‘79 • New loop constructs
– 1998 ratification • Initializers
– Added object-oriented
programming
– Templates (generics)
C Principles
• C was invented during a time when every byte
and every cycle mattered:
– Language elements correspond directly to machine
language elements
• Code is compiled for a specific architecture
• Statements were easily translated to assembly
• Data types match machine representations
– 16-bit computer = 16-bit integers
• Pointers are memory addresses
• Arrays are blocks of memory, not objects
• Type information was not stored, but only used at compile
time
– This has improved
• Data was often packed together for efficiency
C Principles
• C was invented during a time when every byte and every
cycle mattered:
– Original C compilation was costly
• Large projects are separated into many small source code
files
• Compilers were designed to make a single pass through the
code
• Compilation produced intermediate object files which needed
to be linked to build the application
– Your code is small units that are later stitched together to form
the application.
• It was necessary to allow the code to control the compilation
process
– Source code directives
C++ Principles
• Retain the power of C
• Add a better development experience
• C++ is a bit unusual in that it supports
many programming styles
– OO
– functional
– procedural
– generic
Basics of C++
• You already know a lot of C++
• You can understand what these lines mean
int number = 5;
for (int count = 0; count < 10; count++) {
cout << “Hi!” << endl;
}
number = number * (4 + 3);
A Full Program
• An executable program has a main function with
return type int
– the return is the status of the execution, not the
answer
• Your main function is not in a class
int main() {
return 0; // 0 is good
}
• return is optional in main
Command Line Compilation
• In a terminal/xterm/etc.
> g++ -o test test.cpp
> is the command line prompt
• g++ is the GNU C++ compiler
• -o test
– specifies the output name of the executable
• test.cpp is the C++ file
• test is a file of machine instructions specific to
the machine the code is compiled for.
C Leftovers
• Still a lot of C in C++
• Need to recognize the C parts of the language
• Built-in types
– Variables are typed. They stay that type.
– Connected to underlying machine
– Standard gives range of values they must hold, but
commonly
char 1 byte ‘a’
int 4 bytes 12
double 8 bytes 12.00001
bool 1 byte true, false
Declaring Variables
• Variables are declared before use
• Example
int count = 0; // initialize
int value; // just declare
value = 10 * 42;
• Identifiers
– One or more letters, digits, underscore. Must begin
with a letter or _. Cannot match C++ keyword.
– Are case sensitive
Undefined Behavior
• A main issue with C++ is that it allows
undefined behavior!
int number;
cout << number << endl;
• You will need to work hard to avoid
undefined behavior
– You may submit homework that works on your
machine but fails on mine
– Use compiler flags –Wall and others all the
time
Initialization
• Kind of a mess
– C-like
int x = 1;
– Constructor
int x(0);
– Uniform (C++11 standard)
int x{0};
We will discuss how all this works later
Arrays
• Very simple data structures
• Fixed size
int values[10];
• Index from 0
values[0],…,values[9]
• No object-like behavior
– Cannot query for size!
Functions
returnType functionName(parameter1, p2,…) {
function body
}
Parameters are a type followed by an identifier. Each
parameter is comma separated, even of the same type.
int max(int num1, int num2) {
if (num1 > num2)
return num1;
else
return num2;
}
Functions
• Functions need to be declared before called
• This can be just a declaration and not the definition
– the declaration is the return type, the function name, and the
types (with optional name) of the parameters
int max(int num1, int num2);
int max(int, int);
• The definition is the actual code
• Why do we need declarations?
– Functions must be declared before calling them
– See example done in class
Tomorrow Lab
• Making a small C++ program
• Working on a command line
– Looking at folders and files
– Paths
– Jobs
• Compile something