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
d5df4add
Commit
d5df4add
authored
7 years ago
by
Sepehr Bayat
Browse files
Options
Downloads
Patches
Plain Diff
Delete T4.tex
parent
51345a84
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tutorials/T04-A2Example/slides/T4.tex
+0
-544
0 additions, 544 deletions
Tutorials/T04-A2Example/slides/T4.tex
with
0 additions
and
544 deletions
Tutorials/T04-A2Example/slides/T4.tex
deleted
100644 → 0
+
0
−
544
View file @
51345a84
% Define Document Class
% Class Options Include:
% notes, notesonly, handout, trans,
% hidesubsections, shadesubsections,
% inrow, blue, red, grey, brown
%--------------------------------------------------------------------------
\documentclass
[xcolor=dvipsnames, shownotes, colorlinks]
{
beamer
}
%--------------------------------------------------------------------------
% Define Package Theme
%--------------------------------------------------------------------------
\usepackage
{
color
}
\usepackage
[T1]
{
fontenc
}
%% \usepackage{fix-cm}
\usepackage
{
hyperref
}
\hypersetup
{
urlcolor=cyan,
linkcolor=white
}
\usepackage
{
subfigure
}
%% \usepackage{xspace}
\usepackage
{}
\usepackage
{
enumerate
}
\usetheme
{
Antibes
}
\setbeamertemplate
{
sidebar
}
[right]
\usepackage
{
listings
}
% Code formatting
%% \usepackage{framed}
%% \usepackage{booktabs}
\usepackage
{
tabularx
}
\usepackage
{
marvosym
}
\usepackage
{
tikz
}
\usetikzlibrary
{
shapes
}
\usetikzlibrary
{
arrows
}
\usetikzlibrary
{
calc,positioning
}
\lstset
{
language=Python,
basicstyle=
\ttfamily\scriptsize
,
tabsize=2,
breaklines=true,
prebreak=
\raisebox
{
0ex
}
[0ex][0ex]
{
\ensuremath
{
\hookleftarrow
}}
,
frame=single,
showstringspaces=true,
showspaces=false,
keywordstyle=
\color
{
blue
}
,
stringstyle=
\color
{
magenta
}
,
commentstyle=
\color
{
ForestGreen
}
,
literate=
{
\#
}{{
\textcolor
{
ForestGreen
}{
\#
}}}
1
{
@
}{{
\textcolor
{
blue
}{
\MVAt
}}}
1
{
\$
}{
\vdots
}
1
}
%--------------------------------------------------------------------------
% Commands
%------------------------------------------------------------------------------
\newcommand*\oldmacro
{}
%
\let\oldmacro\insertshorttitle
%
\renewcommand*\insertshorttitle
{
%
\oldmacro\hfill
%
\insertframenumber\,
/
\,\inserttotalframenumber
}
% Figure Source
\usepackage
[absolute,overlay]
{
textpos
}
\setbeamercolor
{
framesource
}{
fg=gray
}
\setbeamerfont
{
framesource
}{
size=
\tiny
}
\newcommand
{
\source
}
[1]
{
\begin{textblock*}
{
\paperwidth
}
(-5pt,
\textheight
)
\begin{beamercolorbox}
[ht=0.5cm,right]
{
framesource
}
\usebeamerfont
{
framesource
}
\usebeamercolor
[fg]
{
framesource
}
Source:
{
#1
}
\end{beamercolorbox}
\end{textblock*}
}
%------------------------------------------------------------------------------
% Presentation Title Slide
%--------------------------------------------------------------------------
\title
{
MIS Example
}
\subtitle
{
CS 2ME3/SE 2AA4
}
\author
{
Gurankash Singh
}
\institute
{
Department of Computing and Software
\\
McMaster University
\\
}
\date
{
January 30 - Feburary 3
}
%--------------------------------------------------------------------------
% Document
% To add notes to the slides use: \note{}
% Add \section{} or \subsection{} for use in table of contents
%--------------------------------------------------------------------------
\begin{document}
% Create Title Slide
\begin{frame}
\maketitle
\end{frame}
\section
[Outline]
{}
% Create Table of Contents Slide - Outline
\begin{frame}
\frametitle
{
Outline
}
{
\hypersetup
{
linkcolor=black
}
\tableofcontents
}
\end{frame}
\section
{
What is a module?
}
\begin{frame}
\frametitle
{
What is a module?
}
\begin{itemize}
\item
A file with encapsulated code to implement a specific functionality
\item
Ex: For designing a website with a login system, we may have a module that deals with logging out
\item
A module comes with an "interface"
\item
An interface includes things like functions and arguments of the function
\end{itemize}
\end{frame}
% --------------------------------------------------
% --------------------------------------------------
\begin{frame}
\frametitle
{
What is a MIS?
}
\begin{itemize}
\item
Module Interface Specification
\item
Specifices externally observable behaviour of a module
\item
Not in language of implementation, but uses mathematical and application language
\item
Internal implementations are not included in a MIS
\end{itemize}
\end{frame}
% --------------------------------------------------
% --------------------------------------------------
\section
{
MIS Template
}
\begin{frame}
\frametitle
{
MIS Template Structure
}
\begin{itemize}
\item
Uses
\begin{itemize}
\item
Imported constants, data types and access programs
\end{itemize}
\item
Syntax
\begin{itemize}
\item
Exported constants and types
\item
Exported functions (access routine interface syntax)
\end{itemize}
\item
Semantics
\begin{itemize}
\item
State variables
\item
State invariants
\item
Assumptions
\item
Access routine semantics
\item
Local functions
\item
Local types
\item
Local constants
\item
Considerations
\end{itemize}
\end{itemize}
\end{frame}
% --------------------------------------------------
% --------------------------------------------------
\section
{
Example
}
\begin{frame}
\frametitle
{
Example
}
Consider implementation of point masses on two dimensional plane
\begin{itemize}
\item
Position P is represented by pair of real numbers (x,y)
\item
Mass m is represented by a real number
\item
Considering two point masses that have the corresponding positions and masses of
$
P
_
1
$
and
$
P
_
2
$
and
$
m
_
1
$
and
$
m
_
2
$
, respectively, the force
$
F
$
exerted by one mass on the other is given by Newton's law of
universal gravitation:
$$
F
=
G
\frac
{
m
_
1
m
_
2
}{
r
^
2
}$$
\noindent
where
$
r
$
is the distance between positions
$
P
_
1
$
and
$
P
_
2
$
and
$
G
=
6
.
672
\times
10
^{
-
11
}
\mbox
{
N
}
\cdot
\mbox
{
m
}^
2
/
\mbox
{
kg
}^
2
$
.
\end{itemize}
\end{frame}
% --------------------------------------------------
% --------------------------------------------------
\subsection
{
Point ADT Module
}
\begin{frame}
\frametitle
{
Point ADT Module
}
\textbf
{
Template Module
}
\\
pointADT
\newline
\textbf
{
Uses
}
\\
N/A
\newline
\textbf
{
Syntax
}
\\
Exported Types:
\newline
pointT = ?
\end{frame}
% --------------------------------------------------
\begin{frame}
\textbf
{
Exported Access Programs
}
\\
~
\newline
\begin{tabular}
{
| l | l | l | l |
}
\hline
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\hline
init
&
real, real
&
pointT
&
~
\\
\hline
xcoord
&
~
&
real
&
~
\\
\hline
ycoord
&
~
&
real
&
~
\\
\hline
dist
&
pointT
&
real
&
~
\\
\hline
\end{tabular}
\end{frame}
% --------------------------------------------------
\begin{frame}
\textbf
{
Semantics
}
State Variables:
$
xc
$
: real
\\
$
yc
$
: real
~
\newline
\textbf
{
State Invariant
}
None
~
\newline
\textbf
{
Assumptions
}
init() is called for each abstract object before any other access routine is called for that object
\end{frame}
% --------------------------------------------------
\begin{frame}
\frametitle
{
Point ADT Module
}
\textbf
{
Access Routine Semantics
}
\\
init(
$
x, y
$
):
\begin{itemize}
\item
transition:
$
xc, yc :
=
x, y
$
\item
output:
$
out :
=
\mathit
{
self
}$
\item
exception: none
\end{itemize}
\noindent
xcoord():
\begin{itemize}
\item
output:
$
out :
=
xc
$
\item
exception: none
\end{itemize}
\noindent
ycoord():
\begin{itemize}
\item
output:
$
out :
=
yc
$
\item
exception: none
\end{itemize}
\noindent
dist(
$
p
$
):
\begin{itemize}
\item
output:
$
out :
=
\sqrt
{
(
\mathit
{
self
}
.xc
-
p.
\mbox
{
xcoord
()
}
)
^
2
+
(
\mathit
{
self
}
.yc
-
p.
\mbox
{
ycoord
()
}
)
^
2
}$
\item
exception: none
\end{itemize}
\end{frame}
% --------------------------------------------------
\begin{frame}
[fragile]
\frametitle
{
MIS Interface
}
From the MIS we can deduce the interface of the code will look like:
\begin{lstlisting}
# Interface
class pointT:
# Constructor
def
__
init
__
(self, x, y):
# Selectors
def xcoord(self):
def ycoord(self):
def dist(self, p):
\end{lstlisting}
\end{frame}
% --------------------------------------------------
\begin{frame}
\frametitle
{
MIS Implementation
}
\begin{center}
\textbf
{
See PointADT.py for implementation.
}
\\
\end{center}
\end{frame}
% --------------------------------------------------
%
%
%
%
%
%
% --------------------------------------------------
\subsection
{
Point Mass Module
}
\begin{frame}
\frametitle
{
Point Mass Module
}
\textbf
{
Template Module
}
\\
pointMassADT
\newline
\textbf
{
Uses
}
\\
PointADT
\newline
\textbf
{
Syntax
}
\\
Exported Types:
\newline
pointMassT = ?
\end{frame}
% --------------------------------------------------
\begin{frame}
\textbf
{
Exported Access Programs
}
\\
~
\newline
\begin{tabular}
{
| l | l | l | l |
}
\hline
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\hline
init
&
pointT, real
&
pointMassT
&
~
\\
\hline
point
&
~
&
pointT
&
~
\\
\hline
mval
&
~
&
real
&
~
\\
\hline
force
&
pointMassT
&
real
&
~
\\
\hline
Fx
&
pointMassT
&
real
&
~
\\
\hline
\end{tabular}
\end{frame}
% --------------------------------------------------
\begin{frame}
\textbf
{
Semantics
}
State Variables:
$
pt
$
: pointT
\\
$
ms
$
: real
~
\newline
\textbf
{
State Invariant
}
None
~
\newline
\textbf
{
Assumptions
}
init() is called for each abstract object before any other access routine is called for that object
\end{frame}
% --------------------------------------------------
\begin{frame}
\textbf
{
Access Routine Semantics
}
\\
init(
$
p, m
$
):
\begin{itemize}
\item
transition:
$
pt, ms :
=
p, m
$
\item
output:
$
out :
=
\mathit
{
self
}$
\item
exception: none
\end{itemize}
\noindent
point():
\begin{itemize}
\item
output:
$
out :
=
pt
$
\item
exception: none
\end{itemize}
\noindent
mval():
\begin{itemize}
\item
output:
$
out :
=
ms
$
\item
exception: none
\end{itemize}
\end{frame}
% --------------------------------------------------
\begin{frame}
\noindent
force(
$
p
$
):
\begin{itemize}
\item
output:
$$
out :
=
\mathrm
{
UNIVERAL
\_
G
}
\frac
{
\mathit
{
self
}
.ms
\times
p.
\mathrm
{
mval
}
()
}
{
\mathit
{
self
}
.pt.
\mathrm
{
dist
}
(
p.
\mathrm
{
point
()
}
)
^
2
}$$
\item
exception: none
\end{itemize}
\noindent
Fx(
$
p
$
):
\begin{itemize}
\item
output:
$$
out :
=
\mathit
{
self
}
.
\mathrm
{
force
}
(
p
)
\frac
{
p.
\mathrm
{
point
()
}
.
\mathrm
{
xcoord
}
()
-
\mathit
{
self
}
.pt.
\mathrm
{
xcoord
}
()
}
{
\mathit
{
self
}
.pt.
\mathrm
{
dist
}
(
p.
\mathrm
{
point
()
}
)
}$$
\item
exception: none
\end{itemize}
\textbf
{
Local Constants
}
\\
UNIVERAL
\_
G
$
=
6
.
672
\times
10
^{
-
11
}$
\end{frame}
% --------------------------------------------------
\begin{frame}
[fragile]
\frametitle
{
MIS Interface
}
From the MIS we can deduce the interface of the code will look like:
\begin{lstlisting}
# Interface
class pointMassT:
#Constructor
def
__
init
__
(self, p, m):
#Selectors
def point(self):
def mval(self):
def force(self, p):
def Fx(self, p):
\end{lstlisting}
\end{frame}
% --------------------------------------------------
\begin{frame}
\frametitle
{
MIS Implementation
}
\begin{center}
\textbf
{
See PointMassADT.py for implementation.
}
\\
\end{center}
\end{frame}
% --------------------------------------------------
% -----------------------------------------------------
\begin{frame}
\frametitle
{
Implementation files
}
\begin{itemize}
\item
Implementation files PointADT.py and PointMassADT.py can be found in the repo under Tutorial/T4/src
\end{itemize}
\end{frame}
\end{document}
\ No newline at end of file
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