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
b7ed59c0
Commit
b7ed59c0
authored
7 years ago
by
W. Spencer Smith
Browse files
Options
Downloads
Patches
Plain Diff
Initial edits to Parnas Tables lecture
parent
79f3608d
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/L28_ParnasTables/ParnasTables.pdf
+0
-0
0 additions, 0 deletions
Lectures/L28_ParnasTables/ParnasTables.pdf
Lectures/L28_ParnasTables/ParnasTables.tex
+33
-135
33 additions, 135 deletions
Lectures/L28_ParnasTables/ParnasTables.tex
with
33 additions
and
135 deletions
Lectures/L28_ParnasTables/ParnasTables.pdf
+
0
−
0
View file @
b7ed59c0
No preview for this file type
This diff is collapsed.
Click to expand it.
Lectures/L28_ParnasTables/ParnasTables.tex
+
33
−
135
View file @
b7ed59c0
...
...
@@ -29,7 +29,7 @@
\mode
<presentation>
{}
\input
{
../def-beamer
}
\Draft
tru
e
\Draft
fals
e
\newcommand
{
\topicTitle
}{
28 Parnas Tables
}
\ifDraft
...
...
@@ -54,7 +54,7 @@
\begin{itemize}
\item
Today's slide are partially based on slides by Dr.
\
Wassyng
\item
Administrative details
\item
Translating English to Math exercise
\item
Design patterns
\item
Motivating example: midterm question
\item
History of tables
\item
Example tables
...
...
@@ -78,16 +78,17 @@ TBD
{
\begin{itemize}
\item
A3
deadlines
\item
A3
\begin{itemize}
\item
Part
2
-
Code: due 11:59 pm
Mar
20
\item
\structure
{
Part 1 spec available in repo
}
\item
Part
1
-
Solution:
Mar
18
\item
Part 2 - Code: due 11:59 pm Mar 26
\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
\end{itemize}
...
...
@@ -99,178 +100,75 @@ TBD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Exercise
}
\bi
\item
\href
{
http://www.lonelyplanet.com/blog/2011/11/24/lost-in-translation-our-top-20-photos/
}{
For
SE Section
}
\ei
Consider an array
$
D
$
with index values ranging from
$
1
$
to
$
n
$
. The subject of this example is part of a specification
for a subprogram that will count how many times a particular given value occurs in the array
$
D
$
.
\\
~
\newline
The goal of this exercise is to write a postcondition for the subprogram, relating the various relevant variablesÕ
values when the search is complete.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Exercise Continued
}
Understand the task in the original language
\begin{itemize}
\item
Identify objects referred to (look for nouns in the original English text)
\item
<2->
\structure
<2>
{
Array
$
D
$
, index value, times (count), particular given value, relevant variables's value
}
\item
Identify missing information
\item
<3->
\structure
<3>
{
Names of variable for: index, times (count), particular given value
}
\item
<4->
\structure
<4>
{
Are there any other relevant variables?
}
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Exercise
}
\begin{itemize}
\item
Identify missing information
\item
Names of variable for
\begin{itemize}
\item
Index: assume
$
i
$
\item
Times (count): ask the author of the task, assume
$
\mathit
{
count
}$
\item
Particular given value: Ask the author of the task, assume
$
\mathit
{
key
}$
\item
Are there any other relevant variables? (no?)
\end{itemize}
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Exercise Continued
}
\begin{itemize}
\item
Close the gap between English text and mathematics
\begin{itemize}
\item
Reword the English text to be closer to mathematics
\item
Use the English verb
$
\mathit
{
count
}$
\end{itemize}
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Exercise Continued
}
\frametitle
{
Command Processor Pattern
}
\begin{itemize}
\item
The English verb
$
count
$
means, in programming language and in terms closer to mathematics,
$
\mathit
{
add
}$
$
1
$
\item
But this is a dynamic (action) concept
\item
The corresponding static (state, relational) concept in mathematics is the function
\textit
{
addition with 1
}
,
that is
$
+
1
$
\item
Context: User interfaces which must be flexible or provide functionality that goes beyond the direct handling of
user functions. Examples are undo facilities or logging functions
\item
Problem: We want a well-structured solution for mapping an interface to the internal functionality of a system.
All `extras' which have to do with the way user commands are input, additional commands such as undo and redo, and any
non-application-specific processing of user commands, such as logging, should be kept separate from the interface to
the internal functionality.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Exercise
Continued
}
\frametitle
{
Command Processor Pattern
Continued
}
\begin{itemize}
\item
The occurrence of the particular given value in an array element in
$
D
$
\item
$
D
[
i
]
=
\mathit
{
key
}$
\item
A condition for the addition with 1
\item
The repetition over a variable number of index values suggests quantification with the function addition and
with the argument
$
1
$
\item
$
+(
i : ? | ...
\wedge
D
[
i
]
=
\mathit
{
key
}
:
1
)
$
\item
Solution: A separate component, the
\structure
{
command processor
}
, takes care of all commands. The command
processor component schedules the execution of commands, stores them for later undo, logs them for later analysis, and
so on. The actual execution of the command is delegated to a supplier component within the application.
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Exercise Continued
}
\frametitle
{
Adapter Design Pattern
}
Identify relationships between essential objects
\begin{itemize}
\item
Array
$
D
$
, index value, particular given value:
$
D
[
i
]
=
\mathit
{
key
}$
\item
Combine the above with count (
$
+
$
conditionally with
$
1
$
)
\item
$
\mathit
{
count
}
=
+(
i:
\mathbb
{
N
}
| ...
\leq
i
\leq
...
\wedge
D
[
i
]
=
\mathit
{
key
}
:
1
)
$
\item
Range of
$
i
$
missing
\item
Refer to original English text:
$
1
$
to
$
n
$
\item
$
\mathit
{
count
}
=
+(
i:
\mathbb
{
N
}
|
1
\leq
i
\leq
n
\wedge
D
[
i
]
=
\mathit
{
key
}
:
1
)
$
\end{itemize}
\structure
{
When have we used the adapter (or wrapper) design pattern?
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Exercise: New Glossary Entry
}
Now we have a new entry for our glossary
\frametitle
{
Adapter Design Pattern
}
\begin{itemize}
\item
count:
$
+(
i:
\mathbb
{
N
}
| ...
\leq
i
\leq
...
\wedge
... :
1
)
$
, where the ... defines the range of the
quantified variable and the condition for counting
\end{itemize}
\includegraphics
[scale=0.7]
{
../Figures/500px-AdapterPatternForWiki.jpg
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Summary
}
\begin{itemize}
\frametitle
{
Factory Pattern
}
\item
Knowledge of English and Mathematics is necessary but not sufficient to translate into Mathematics
\item
Knowledge of subject area also needed
\item
Translating skills needed
\item
The three are different
\includegraphics
[scale=0.55]
{
../Figures/factory
_
pattern
_
uml
_
diagram.jpg
}
\
end{itemiz
e}
\
href
{
https://www.tutorialspoint.com/design
_
pattern/factory
_
pattern.htm
}{
Cod
e
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
S
ummary
}
\frametitle
{
S
ingleton Pattern
}
\begin{itemize}
\item
Compile your own glossary
\item
Make intermediate steps and expressions conscious
\item
Modularize
\item
Organize systematically
\item
KISSS
\end{itemize}
\includegraphics
[scale=1.7]
{
../Figures/Singleton.jpg
}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle
{
Tables Motivating Example: ptOn(c, s)
}
...
...
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