object aggregation, attributes
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri Feb 27 10:03:07 2009 +0100 (11 months ago)
changeset 785a194594388
parent 6 e24f63454eea
child 8 50a0381cd6e4
object aggregation, attributes
Makefile
object-aggregation.dia
wns3.tex
     1.1 --- a/Makefile	Thu Feb 26 21:48:56 2009 +0100
     1.2 +++ b/Makefile	Fri Feb 27 10:03:07 2009 +0100
     1.3 @@ -9,7 +9,7 @@
     1.4  
     1.5  all: wns3.pdf
     1.6  
     1.7 -wns3.pdf: wns3.tex scenario.pdf
     1.8 +wns3.pdf: wns3.tex scenario.pdf object-aggregation.pdf
     1.9  	pdflatex wns3.tex
    1.10  
    1.11  force:
     2.1 Binary file object-aggregation.dia has changed
     3.1 --- a/wns3.tex	Thu Feb 26 21:48:56 2009 +0100
     3.2 +++ b/wns3.tex	Fri Feb 27 10:03:07 2009 +0100
     3.3 @@ -102,6 +102,10 @@
     3.4  \begin{verbatim}
     3.5    Node *node0 = new Node ();
     3.6  \end{verbatim}
     3.7 +Or:
     3.8 +\begin{verbatim}
     3.9 +  Node node0 = Node ();
    3.10 +\end{verbatim}
    3.11  \end{frame}
    3.12  
    3.13  \begin{frame}{Templates: the Nasty Brackets}
    3.14 @@ -125,6 +129,7 @@
    3.15  \item No garbage collector
    3.16  \item Easy to forget to delete an object
    3.17  \item Pointer cycles
    3.18 +\item Ensure coherency and uniformity
    3.19  \end{itemize}
    3.20  So, we use:
    3.21  \begin{itemize}
    3.22 @@ -150,7 +155,7 @@
    3.23  \item Others need other unknown features.
    3.24  \item The obvious solution: add everything to the Node base class, but:
    3.25  \begin{itemize}
    3.26 -\item The class will grow uncontrolably over time
    3.27 +\item The class will grow uncontrollably over time
    3.28  \item Everyone will need to patch the class
    3.29  \item Slowly, every piece of code will depend on every other piece of code
    3.30  \item A maintenance nightmare...
    3.31 @@ -158,14 +163,26 @@
    3.32  \item A better solution:
    3.33  \begin{itemize}
    3.34  \item Separate functionality belongs to separate classes
    3.35 -\item Objects can be aggregated to obtain extra functionality
    3.36 +\item Objects can be aggregated at runtime to obtain extra functionality
    3.37  \end{itemize}
    3.38  \end{itemize}
    3.39  \end{frame}
    3.40  
    3.41  \begin{frame}[fragile]{Object aggregation}
    3.42  
    3.43 -XXX: Potentially, explain more about GetObject/AggregateObject
    3.44 +\begin{columns}[T]
    3.45 +\begin{column}{0.4\textwidth}
    3.46 +\includegraphics[width=8cm]{object-aggregation}
    3.47 +\end{column}
    3.48 +\begin{column}{0.6\textwidth}
    3.49 +\begin{itemize}
    3.50 +\item A circular singly linked-list
    3.51 +\item AggregateObject is a constant-time operation
    3.52 +\item GetObject is a O(n) operation
    3.53 +\item Aggregate contains only one object of each type
    3.54 +\end{itemize}
    3.55 +\end{column}
    3.56 +\end{columns}
    3.57  
    3.58  \end{frame}
    3.59  
    3.60 @@ -184,11 +201,27 @@
    3.61  csmaChannel->SetAttribute ("DataRate", 
    3.62                             StringValue ("5Mbps"));
    3.63  \end{verbatim}
    3.64 +\end{itemize}
    3.65 +\end{frame}
    3.66 +
    3.67 +\begin{frame}[fragile]{Configuration: Object Attributes}
    3.68 +
    3.69 +\begin{itemize}
    3.70  \item Set an attribute on a specific object with a path:
    3.71  \begin{verbatim}
    3.72  Config::Set ("/NodeList/3/DeviceList/1/Channel/DataRate",
    3.73               StringValue ("5Mbps"));
    3.74  \end{verbatim}
    3.75 +\item Set an attribute on a specific object from a configuration file:
    3.76 +\begin{verbatim}
    3.77 +/NodeList/3/DeviceList/1/Channel/DataRate 5Mbps
    3.78 +...
    3.79 +\end{verbatim}
    3.80 +with:
    3.81 +\begin{verbatim}
    3.82 +ConfigStore config;
    3.83 +config.Configure ();
    3.84 +\end{verbatim}
    3.85  \item Set an attribute on a specific object with a GUI:
    3.86  \begin{verbatim}
    3.87  GtkConfigStore config;