Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
se2aa4_cs2me3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
W. Spencer Smith
se2aa4_cs2me3
Commits
03ebddd8
Commit
03ebddd8
authored
7 years ago
by
W. Spencer Smith
Browse files
Options
Downloads
Patches
Plain Diff
Updates to L12 on Object Oriented Design - more questions
parent
ad881481
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Lectures/L12_OOD/OOD.pdf
+0
-0
0 additions, 0 deletions
Lectures/L12_OOD/OOD.pdf
Lectures/L12_OOD/OOD.tex
+155
-24
155 additions, 24 deletions
Lectures/L12_OOD/OOD.tex
with
155 additions
and
24 deletions
Lectures/L12_OOD/OOD.pdf
+
0
−
0
View file @
03ebddd8
No preview for this file type
This diff is collapsed.
Click to expand it.
Lectures/L12_OOD/OOD.tex
+
155
−
24
View file @
03ebddd8
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
unicode=false
}
unicode=false
}
\urlstyle
{
same
}
\urlstyle
{
same
}
\usepackage
{
listings
}
\usepackage
{
booktabs
}
\usepackage
{
booktabs
}
\useoutertheme
{
split
}
%so the footline can be seen, without needing pgfpages
\useoutertheme
{
split
}
%so the footline can be seen, without needing pgfpages
...
@@ -21,7 +23,7 @@
...
@@ -21,7 +23,7 @@
\mode
<presentation>
{}
\mode
<presentation>
{}
\input
{
../def-beamer
}
\input
{
../def-beamer
}
\Draft
tru
e
\Draft
fals
e
\newcommand
{
\topicTitle
}{
12 Object Oriented Design (Ghezzi Ch.
\
4)
}
\newcommand
{
\topicTitle
}{
12 Object Oriented Design (Ghezzi Ch.
\
4)
}
\ifDraft
\ifDraft
...
@@ -36,6 +38,9 @@
...
@@ -36,6 +38,9 @@
\input
{
../footline
}
\input
{
../footline
}
\lstset
{
language=python, breaklines=true, showspaces=false,
showstringspaces=false, breakatwhitespace=true, texcl=true, escapeinside=
{
\%*
}{
*)
}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\begin{frame}
...
@@ -61,21 +66,11 @@ TBD
...
@@ -61,21 +66,11 @@ TBD
\else
\else
{
{
\begin{itemize}
\begin{itemize}
\item
NSERC Undergraduate Student Research Award
\item
Assignment 1
\item
Assignment 1
\begin{itemize}
\begin{itemize}
\item
E-mail your partner if you haven't already done so
\item
Part 2: January 31, 2018
\item
E-mail the instructor if you haven't received your partner's code
\item
Lab report due by 11:59 pm February 2
\end{itemize}
\item
Assignment 2
\begin{itemize}
\item
Files due by 11:59 pm Feb 15
\item
E-mail partner files by 11:59 pm Feb 16
\item
Lab report due by 11:59 pm Feb 27
\end{itemize}
\end{itemize}
\item
Questions?
\end{itemize}
\end{itemize}
}
}
\fi
\fi
...
@@ -94,13 +89,119 @@ TBD
...
@@ -94,13 +89,119 @@ TBD
to review changes between commits
to review changes between commits
\item
Review before committing:
\texttt
{
git difftool
}
\item
Review before committing:
\texttt
{
git difftool
}
\item
To better deal with changes, use a ``hard wrap'' at an 80 column width,
\item
To better deal with changes, use a ``hard wrap'' at an 80 column width,
even for LaTeX documents
even for LaTeX documents
(
\structure
{
why?
}
)
\end{itemize}
\end{itemize}
\end{frame}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Set Idiom (H
\&
S)
}
\begin{tabular}
{
| l | l | l | l |
}
\hline
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\hline
set
\_
add
&
T
&
~
&
Member, Full
\\
\hline
set
\_
del
&
T
&
~
&
NotMember
\\
\hline
set
\_
member
&
T
&
boolean
&
~
\\
\hline
set
\_
size
&
~
&
integer
&
~
\\
\hline
\end{tabular}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Sequence Idiom (H
\&
S)
}
\begin{tabular}
{
| l | l | l | l |
}
\hline
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\hline
seq
\_
init
&
~
&
~
&
~
\\
\hline
seq
\_
add
&
integer, T
&
~
&
PosOutOfRange, Full
\\
\hline
seq
\_
del
&
integer
&
~
&
PosOutOfRange
\\
\hline
seq
\_
setval
&
integer, T
&
~
&
PosOutOfRange
\\
\hline
seq
\_
getval
&
integer
&
T
&
PosOutOfRange
\\
\hline
seq
\_
size
&
~
&
integer
&
~
\\
\hline
seq
\_
start
&
~
&
~
&
~
\\
\hline
seq
\_
next
&
~
&
T
&
AtEnd
\\
\hline
seq
\_
end
&
~
&
boolean
&
~
\\
\hline
seq
\_
append
&
T
&
~
&
Full
\\
\hline
\end{tabular}
\\
~
\\
\structure
<1>
{
When would you use seq
\_
next in the interface, and exclude
seq
\_
getval?
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Tuple Idiom Version 1 (H
\&
S)
}
\begin{tabular}
{
| l | l | l | l |
}
\hline
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\hline
tp
\_
init
&
~
&
~
&
~
\\
\hline
tp
\_
set
\_
f
$_
1
$
&
T
$_
1
$
&
~
&
~
\\
\hline
tp
\_
get
\_
f
$_
1
$
&
~
&
T
$_
1
$
&
~
\\
\hline
...
&
...
&
...
&
...
\\
\hline
tp
\_
set
\_
f
$_
N
$
&
T
$_
N
$
&
~
&
~
\\
\hline
tp
\_
get
\_
f
$_
N
$
&
~
&
T
$_
N
$
&
~
\\
\hline
\end{tabular}
\\
~
\\
\structure
{
What is a potential problem with this idiom, especially if there are
many fields to the tuple?
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Tuple Idiom Version 2 (H
\&
S)
}
\begin{tabular}
{
| l | l | l | l |
}
\hline
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\hline
tp
\_
init
&
~
&
~
&
~
\\
\hline
tp
\_
set
&
T
$_
1
$
, T
$_
2
$
, ..., T
$_
N
$
&
~
&
~
\\
\hline
tp
\_
get
&
~
&
T
&
~
\\
\hline
\end{tabular}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\begin{frame}
\frametitle
{
Object Oriented Design
}
\frametitle
{
Object Oriented Design
}
\begin{itemize}
\begin{itemize}
...
@@ -126,6 +227,13 @@ TBD
...
@@ -126,6 +227,13 @@ TBD
\item
A is a superclass of B
\item
A is a superclass of B
\item
B is a subclass of A
\item
B is a subclass of A
\end{itemize}
\end{itemize}
~
\\
\structure
<1>
{
In Python, what class do all classes inherit?
}
\\
%object
~
\\
\structure
<2>
{
What method inherited from object did we recently override?
}
\\
% __eq__
~
\\
\end{frame}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
@@ -196,14 +304,18 @@ def\_skill & skillT & ~ & ~\\
...
@@ -196,14 +304,18 @@ def\_skill & skillT & ~ & ~\\
\begin{itemize}
\begin{itemize}
\item
A way of building software incrementally
\item
A way of building software incrementally
\item
Useful for long lived applications because new features can be added without breaking the old applications
\item
Useful for long lived applications because new features can be added
without breaking the old applications
\item
A subclass defines a subtype
\item
A subclass defines a subtype
\item
A subtype is substitutable for the parent type
\item
A subtype is substitutable for the parent type
\item
Polymorphism - a variable referring to type A can refer to an object of type B if B is a subclass of A
\item
Polymorphism - a variable referring to type A can refer to an object of
\item
Dynamic binding - the method invoked through a reference depends on the type of the object associated with the
type B if B is a subclass of A
reference at runtime
\item
Dynamic binding - the method invoked through a reference depends on the
\item
All instances of the sub-class are instances of the super-class, so the type of the sub-class is a subtype
type of the object associated with the reference at runtime
\item
All instances of Administrative
\_
Staff and Technical
\_
Staff are instances of Employee
\item
All instances of the sub-class are instances of the super-class, so the
type of the sub-class is a subtype
\item
All instances of Administrative
\_
Staff and Technical
\_
Staff are instances
of Employee
\end{itemize}
\end{itemize}
\end{frame}
\end{frame}
...
@@ -214,7 +326,10 @@ reference at runtime
...
@@ -214,7 +326,10 @@ reference at runtime
emp1, emp2: Employee
\\
emp1, emp2: Employee
\\
emp3: Technical
\_
Staff
\\
emp3: Technical
\_
Staff
\\
~
\\
\structure
<1>
{
What assignments are allowed? That is, where would polymorphism
allow us to switch references to the RHS with what appears on the LHS?
}
\\
~
\\
emp1 = Administrative
\_
Staff()
\uncover
<2->
{
\structure
{$
\surd
$}}
\\
emp1 = Administrative
\_
Staff()
\uncover
<2->
{
\structure
{$
\surd
$}}
\\
emp2 = Technical
\_
Staff()
\uncover
<3->
{
\structure
{$
\surd
$}}
\\
emp2 = Technical
\_
Staff()
\uncover
<3->
{
\structure
{$
\surd
$}}
\\
emp3 = emp1
\uncover
<4->
{
\structure
{$
\times
$}}
\\
emp3 = emp1
\uncover
<4->
{
\structure
{$
\times
$}}
\\
...
@@ -249,8 +364,10 @@ emp3 = (Technical\_Staff) emp1 \uncover<5->{\structure{$\surd$}}\\
...
@@ -249,8 +364,10 @@ emp3 = (Technical\_Staff) emp1 \uncover<5->{\structure{$\surd$}}\\
\item
UML (Unified Modelling Language) is a widely adopted standard notation for representing OO designs
\item
UML (Unified Modelling Language) is a widely adopted standard notation for representing OO designs
\item
We introduce the UML class diagram
\item
We introduce the UML class diagram
\item
Classes are described by boxes
\item
Classes are described by boxes
\end{itemize}
\end{itemize}
\structure
{
Any guesses on what Parnas said UML stood for?
}
%Undefined Modelling Language
\end{frame}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
@@ -275,6 +392,20 @@ emp3 = (Technical\_Staff) emp1 \uncover<5->{\structure{$\surd$}}\\
...
@@ -275,6 +392,20 @@ emp3 = (Technical\_Staff) emp1 \uncover<5->{\structure{$\surd$}}\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Class Diagram Versus MIS
}
\begin{itemize}
\item
\structure
<1>
{
What information do the MIS and Class Diagram have in common?
}
\item
\structure
<2>
{
What information does the MIS add?
}
%semantics
\item
\structure
<3>
{
What information does the Class Diagram add?
}
%richer set of
%uses relations
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\begin{frame}
\frametitle
{
UML Associations
}
\frametitle
{
UML Associations
}
...
@@ -409,7 +540,7 @@ PointMassT = ?\\
...
@@ -409,7 +540,7 @@ PointMassT = ?\\
\hline
\hline
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\hline
\hline
new PointMassT
&
real, real, real
&
PointMassT
&
NegMassExcept
ion
\\
new PointMassT
&
real, real, real
&
PointMassT
&
NegMassExcept
\\
\hline
\hline
mval
&
~
&
real
&
~
\\
mval
&
~
&
real
&
~
\\
\hline
\hline
...
@@ -437,7 +568,7 @@ $ms$: real
...
@@ -437,7 +568,7 @@ $ms$: real
\begin{itemize}
\begin{itemize}
\item
transition:
$
xc, yc, ms :
=
x, y, m
$
\item
transition:
$
xc, yc, ms :
=
x, y, m
$
\item
output:
$
out :
=
\mathit
{
self
}$
\item
output:
$
out :
=
\mathit
{
self
}$
\item
exception:
$
exc :
=
(
m <
0
\Rightarrow
\mbox
{
Neg
ative
MassExcept
ion
}
)
$
\item
exception:
$
exc :
=
(
m <
0
\Rightarrow
\mbox
{
NegMassExcept
}
)
$
\end{itemize}
\end{itemize}
~
\newline
~
\newline
\noindent
force(
$
p
$
):
\noindent
force(
$
p
$
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment