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
5c807dac
Commit
5c807dac
authored
7 years ago
by
W. Spencer Smith
Browse files
Options
Downloads
Patches
Plain Diff
Edits to SpecViaUML lecture
parent
cd5aa198
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Lectures/L26_SpecViaUML/SpecViaUML.pdf
+0
-0
0 additions, 0 deletions
Lectures/L26_SpecViaUML/SpecViaUML.pdf
Lectures/L26_SpecViaUML/SpecViaUML.tex
+86
-181
86 additions, 181 deletions
Lectures/L26_SpecViaUML/SpecViaUML.tex
with
86 additions
and
181 deletions
Lectures/L26_SpecViaUML/SpecViaUML.pdf
+
0
−
0
View file @
5c807dac
No preview for this file type
This diff is collapsed.
Click to expand it.
Lectures/L26_SpecViaUML/SpecViaUML.tex
+
86
−
181
View file @
5c807dac
...
...
@@ -23,9 +23,9 @@
\mode
<presentation>
{}
\input
{
../def-beamer
}
\Draft
tru
e
\Draft
fals
e
\newcommand
{
\topicTitle
}{
2
7
Specification Via UML (Ch.
\
5 and others)
}
\newcommand
{
\topicTitle
}{
2
6
Specification Via UML (Ch.
\
5 and others)
}
\ifDraft
\newcommand
{
\topic
}{
\topicTitle
~DRAFT
}
\else
...
...
@@ -47,11 +47,13 @@
\begin{itemize}
\item
Administrative details
\item
Software tool of the day
\item
Best specification technique?
\item
Designing spec of modules
\item
Interfaces in UML
\bi
\item
Measurable interface
\item
M
easurer
in
t
er
fac
e
\item
M
ultiple
in
h
er
itance exampl
e
\ei
\item
Generic classes in UML
\item
Use cases with UML
...
...
@@ -71,18 +73,17 @@ TBD
{
\begin{itemize}
\item
\structure
{
Who has skimmed the homework problem?
}
\item
Some delay likely in grading A2
\item
A3 deadlines
\item
A3
\begin{itemize}
\item
Part 1 - S
pecification: due 11:59 pm
\structure
{
Mar 1
1
}
\item
Part 2 - Code: due 11:59 pm Mar 2
0
\item
Part 1 - S
olution:
Mar 1
8
\item
Part 2 - Code: due 11:59 pm Mar 2
6
\end{itemize}
\item
A4
\bi
\item
Your own design and specification
\item
Due April 3 at 11:59 pm
\item
Model module for game of Freecell
\item
Due April 9 at 11:59 pm
\ei
\item
Sources of slides
...
...
@@ -100,22 +101,21 @@ TBD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Best?
}
\frametitle
{
Software Tool of the Day
}
\bi
\item
\structure
{
What is the best software development tool?
}
\item
\structure
{
What is the most important software design principle?
}
\item
\structure
{
What is the best specification technique?
}
\ei
\href
{
https://www.draw.io/
}{
draw.io
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Best
Continued
}
\frametitle
{
Best
?
}
\bi
\item
\structure
{
What is the best software development tool?
}
\item
\structure
{
What is the most important software design principle?
}
\item
\structure
{
What is the best specification technique?
}
\item
\structure
{
What is the best programming language?
}
\item
\structure
{
What is the best engineering/scientific discipline?
}
\item
\structure
{
What is the best movie? video game?
}
...
...
@@ -131,8 +131,9 @@ TBD
\frametitle
{
Deciding the Best Strategy For a Given Problem
}
\bi
\item
Many ways to accomplish the same goals, each with pros and cons
\item
What is the approach at your company?
\item
Likely maintenance, so many decisions have likely been made
.
\item
Likely maintenance, so many decisions have likely been made
\item
What tools/techniques/programming language etc.
\
do you know?
\item
What can you afford in terms of cost/time?
\item
What tool is appropriate for the task at hand?
...
...
@@ -151,110 +152,105 @@ TBD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
UML Diagram of Measurable Interface
}
\includegraphics
[scale=0.65]
{
../Figures/UMLDataSetMeasurableInterface.pdf
}
\frametitle
{
Modelling Larger Components
}
\begin{itemize}
\item
Realization arrow should have an outline triangle
\item
UML diagram can also show interface method names
\item
Realization arrow is like weak generalization (inheritance)
\item
From last day, Baber focuses on translating low level mathematical
expressions
\item
In our specification, we will also need to organize the information
\item
For larger problems, think about your types, Abstract Data Types and
Abstract objects
\item
Interactively switch between types, ADTs, Abstract Objects and detailed
mathematical spec
\item
Example
\bi
\item
Modelling game state for
\href
{
https://www.freecell-solitaire-download.com/rules.html
}
{
Freecell
}
\item
\structure
{
What are some potential types?
}
%suitT, rankT, cardT, deckT,
%stackT, gameBoard
\item
\structure
{
What are some mathematical expressions you will need?
}
%is_validMove
\ei
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
DataSet Without Interface
}
\begin{frame}
\frametitle
{
Base For Examples: DataSet
}
\
lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/
DataSet
.java
}
\
href
{
https://gitlab.cas.mcmaster.ca/smiths/se2aa4
_
cs2me3/tree/master/Lectures/L26
_
SpecViaUML/DataSet
}
{
Data
Set
with Doubles
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
PointT
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/PointT.java
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{frame}
\begin{frame}
\frametitle
{
UML Diagram Datasets of PointT and BankAccount
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\medskip
\begin{frame}
[allowframebreaks]
\frametitle
{
DataSet for Points
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/DataSetPoint.java
}
\includegraphics
[scale=0.85]
{
DataSetsAggregation.pdf
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
Bank Account Class
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/BankAccount.java
}
\begin{frame}
\frametitle
{
Code for DataSetPointT and DataSetBankAccount
}
\end{frame}
\href
{
https://gitlab.cas.mcmaster.ca/smiths/se2aa4
_
cs2me3/tree/master/Lectures/L26
_
SpecViaUML/DataSetPointT
}
{
Data Set with PointT
}
\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
~
\newline
\begin{frame}
[allowframebreaks]
\frametitle
{
DataSet for Bank Accounts
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/DataSetBankAccount.java
}
\href
{
https://gitlab.cas.mcmaster.ca/smiths/se2aa4
_
cs2me3/tree/master/Lectures/L26
_
SpecViaUML/DataSetBankAccount
}
{
Data Set with BankAccount
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
Measurable Interface
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/Measurable.java
}
\begin{frame}
\frametitle
{
Problems
}
\bi
\item
Inadequate reuse
\item
Maintenance challenge
\item
Examples only differ in the measure
\ei
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
Data Set with Measurable Interface
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/DataSetInterface.java
}
\begin{frame}
\frametitle
{
UML Diagram of Measurable Interface
}
\
end{frame}
\
medskip
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\includegraphics
[scale=0.85]
{
MeasurableInterface.pdf
}
\begin{
frame}
[allowframebreaks]
\
frametitle
{
PointT with Measurable Interface
}
\
lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\
noindent
\lstinputlisting
{
./src/PointTInterface.java
}
\begin{
itemize}
\
item
UML diagram can also show interface method names
\
item
Realization arrow is like weak generalization (inheritance)
\
end{itemize
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
Bank Account with Measurable Interface
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/BankAccountInterface.java
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Code For DataSetInterface
}
\begin{frame}
[allowframebreaks]
\frametitle
{
Using DataSet
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/DataSetTest.java
}
\href
{
https://gitlab.cas.mcmaster.ca/smiths/se2aa4
_
cs2me3/tree/master/Lectures/L26
_
SpecViaUML/DataSetInterface
}
{
Data Set with Measurable Interface
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Interface Strategy
}
...
...
@@ -265,15 +261,22 @@ TBD
\item
You can measure an object in only one way
\end{itemize}
\item
Move responsibility for measuring outside of objects themselves
\item
Java
\bi
\item
Have another object carry out the comparison
\item
Introduce a Measurer interface
\ei
\item
C++
\bi
\item
Multiple inheritance
\ei
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
UML Diagram of Measurer Interface
}
\frametitle
{
UML Diagram of Measurer Interface
(Java)
}
\includegraphics
[scale=0.55]
{
../Figures/UMLDataSetMeasurerInterface.pdf
}
...
...
@@ -286,109 +289,11 @@ TBD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
Measurer Interface
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/Measurer.java
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
Data Set with New Strategy
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/DataSetStrategy.java
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
Rectangle Measurer
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/RectangleMeasurer.java
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[allowframebreaks]
\frametitle
{
Using Rectangle Measurer
}
\lstset
{
language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true
}
\noindent
\lstinputlisting
{
./src/DataSetStrategyTest.java
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
[fragile]
\frametitle
{
{
\tt
Comparable
}
Versus
{
\tt
Comparator
}}
\begin{itemize}
\item
Comparable similar UML diagram to Measurable
\item
Comparator similar UML diagram to Measurer
\end{itemize}
\begin{lstlisting}
public interface Comparable<T>
{
int compareTo(T obj);
}
\end{lstlisting}
\begin{lstlisting}
public interface Comparator<T>
{
public int compare(T obj1, T obj2);
}
\end{lstlisting}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Interface Versus Abstract
}
\begin{itemize}
\item
\structure
{
What is the difference between an interface and an abstract class?
}
\end{itemize}
\end{frame}
\frametitle
{
UML Diagram of Multiple Inheritance
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\includegraphics
[scale=0.75]
{
MeasurableInterfaceInheritance.pdf
}
\begin{frame}
%\frametitle{Differences Between Interface and Abstract}
\begin{itemize}
\item
Interface
\bi
\item
Methods are implicitly abstract and public
\item
Methods can have default implementation ( JDK 8)
\item
Cannot have constructors
\item
Variables are final
\item
Can only extend interfaces
\item
Classes can extend multiple instances
\item
Appropriate for unrelated classes
\ei
\item
Abstract class
\bi
\item
At least one method is declared as abstract
\item
Some methods can implement a default behaviour
\item
Cannot instantiate them, but can have constructors
\item
Variables are not necessarily final
\item
Can extend other class
\item
Can implement multiple interfaces
\item
Classes can extend only one abstract class
\item
Sharing code between closely related classes
\ei
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
...
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