From b459dd57fea4cb2068cf70e974405faac6cd97fd Mon Sep 17 00:00:00 2001 From: "Dr. Martin Goik" <goik@hdm-stuttgart.de> Date: Sat, 18 May 2019 09:25:34 +0200 Subject: [PATCH] iarg variable swap, exercise sequence swap --- Doc/Sd1/objectsClasses.xml | 194 ++++++++++++++++++------------------- 1 file changed, 95 insertions(+), 99 deletions(-) diff --git a/Doc/Sd1/objectsClasses.xml b/Doc/Sd1/objectsClasses.xml index 6cf0f1b06..2585f84fe 100644 --- a/Doc/Sd1/objectsClasses.xml +++ b/Doc/Sd1/objectsClasses.xml @@ -1334,89 +1334,6 @@ public class SetterAccess { </tr> </informaltable> </figure> - - <qandaset defaultlabel="qanda" - xml:id="sd1QandaEmployeeFilesystemRepresentation"> - <title>File system representation</title> - - <qandadiv> - <qandaentry> - <question> - <para>In <xref linkend="sd1_qanda_refineAccessEmployee"/> you - moved the <classname>Employee</classname> class to a package - <package>model</package>.</para> - - <para>How are the corresponding <xref linkend="glo_Java"/> files - <filename>Employee.java</filename> and - <filename>Driver.java</filename> being represented? What about - the generated byte code files - <filename>Employee.</filename>class and - <filename>Driver.</filename>class?</para> - - <tip> - <para>Use your OS's file system explorer.</para> - </tip> - </question> - - <answer> - <para>Depending on your type of project (Java, Maven,...) both - your <filename>.java</filename> source files and generated - <filename>.class</filename> files will be organized below their - respective entry level directories. The following typical layout - depends on your Java development environment / <xref - linkend="glo_IDE"/>:</para> - - <glosslist> - <glossentry> - <glossterm><filename>.java</filename> source - files</glossterm> - - <glossdef> - <para>Below folder <filename>src</filename>.</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm><filename>.class</filename> byte code - files</glossterm> - - <glossdef> - <para>Below folder <filename>bin</filename>.</para> - </glossdef> - </glossentry> - </glosslist> - - <para>Packages give rise to further sub directories both for - source code and their generated byte code - <quote>partners</quote>. The following example is a minor - variation of our employee example. The package - <package>model</package> has been transformed into - <package>company.model</package>:</para> - - <figure xml:id="sd1FigPackageHierarchy"> - <title>Package hierarchy of the employee example</title> - - <screenshot> - <info> - <title>On filesystem level the package - <package>company.model</package> becomes a subdirectory - <filename>model</filename> of sub directory - <filename>company</filename> for both our source - (<filename>src</filename>) and bytecode - (<filename>bin</filename>) file hierarchy.</title> - </info> - - <mediaobject> - <imageobject> - <imagedata fileref="Ref/Fig/packageHierarchy.png"/> - </imageobject> - </mediaobject> - </screenshot> - </figure> - </answer> - </qandaentry> - </qandadiv> - </qandaset> </section> <section xml:id="sd1_typeSignature_slide"> @@ -1682,30 +1599,28 @@ public class SetterAccess { </tr> <tr> - <td colspan="2">Same method signature: Only the argument - types matter irrespective of formal parameter names - <varname>value</varname> and - <varname>position</varname>.</td> + <td colspan="2">Same method signature: Formal parameter + names do not matter, only their types are important.</td> </tr> <tr> <td rowspan="2" valign="top">2</td> - <td valign="top"><programlisting language="java">boolean startsWith​(String prefix, int toffset)</programlisting></td> + <td valign="top"><programlisting language="java">boolean startsWith​(int toffset, String prefix)</programlisting></td> <td valign="top">("startsWith", String, int​)</td> </tr> <tr> <td colspan="2">Different method signature: The order of - types being reversed here matters.</td> + types is being reversed here.</td> </tr> <tr> <td rowspan="2" valign="top">3</td> <td valign="top"><programlisting language="java">boolean starts<emphasis - role="red">w</emphasis>ith​(int toffset, String prefix)</programlisting></td> + role="red">w</emphasis>ith​(String prefix, int toffset)</programlisting></td> <td valign="top">("starts<emphasis role="red">w</emphasis>ith", int​, String)</td> @@ -1719,7 +1634,7 @@ public class SetterAccess { <methodname>starts<emphasis role="red">W</emphasis>ith</methodname> and <methodname>starts<emphasis role="red">w</emphasis>ith - differ</methodname>. So do the resulting method + differ</methodname> and thus their resulting method signatures.</td> </tr> </informaltable> @@ -3179,9 +3094,8 @@ public class Driver { <answer> <para>Moving the <classname>Employee</classname> class from its <package>company</package> package to <package>model</package> - changes just one line of code in your - <filename>Employee.java</filename> class namely its <code - language="java">package</code> declaration:</para> + changes just its <code language="java">package</code> + declaration:</para> <informaltable border="1"> <colgroup width="45%"/> @@ -3191,7 +3105,7 @@ public class Driver { <colgroup width="45%"/> <tr> - <td><programlisting language="java"><emphasis role="bold">package company;</emphasis> + <td><programlisting language="java"><emphasis role="red">package company;</emphasis> public class Employee { int age; @@ -3200,7 +3114,7 @@ public class Employee { <td align="center">⟹</td> - <td><programlisting language="java"><emphasis role="bold">package model;</emphasis> + <td><programlisting language="java"><emphasis role="red">package model;</emphasis> public class Employee { int age; @@ -3211,9 +3125,8 @@ public class Employee { <para>The movement also adds an additional <code language="java">import</code> statement to your - <classname>Driver</classname> class which is required since the - <classname>Employee</classname> class now resides in a different - package:</para> + <classname>Driver</classname> class being required since both + classes no longer reside in a common package:</para> <informaltable border="1"> <colgroup width="45%"/> @@ -3366,6 +3279,89 @@ public class Driver { </qandadiv> </qandaset> + <qandaset defaultlabel="qanda" + xml:id="sd1QandaEmployeeFilesystemRepresentation"> + <title>File system representation</title> + + <qandadiv> + <qandaentry> + <question> + <para>In <xref linkend="sd1_qanda_refineAccessEmployee"/> you + moved the <classname>Employee</classname> class to a package + <package>model</package>.</para> + + <para>How are the corresponding <xref linkend="glo_Java"/> files + <filename>Employee.java</filename> and + <filename>Driver.java</filename> being represented? What about + the generated byte code files + <filename>Employee.</filename>class and + <filename>Driver.</filename>class?</para> + + <tip> + <para>Use your OS's file system explorer.</para> + </tip> + </question> + + <answer> + <para>Depending on your type of project (Java, Maven,...) both + your <filename>.java</filename> source files and generated + <filename>.class</filename> files will be organized below their + respective entry level directories. The following typical layout + depends on your Java development environment / <xref + linkend="glo_IDE"/>:</para> + + <glosslist> + <glossentry> + <glossterm><filename>.java</filename> source + files</glossterm> + + <glossdef> + <para>Below folder <filename>src</filename>.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm><filename>.class</filename> byte code + files</glossterm> + + <glossdef> + <para>Below folder <filename>bin</filename>.</para> + </glossdef> + </glossentry> + </glosslist> + + <para>Packages give rise to further sub directories both for + source code and their generated byte code + <quote>partners</quote>. The following example is a minor + variation of our employee example. The package + <package>model</package> has been transformed into + <package>company.model</package>:</para> + + <figure xml:id="sd1FigPackageHierarchy"> + <title>Package hierarchy of the employee example</title> + + <screenshot> + <info> + <title>On filesystem level the package + <package>company.model</package> becomes a subdirectory + <filename>model</filename> of sub directory + <filename>company</filename> for both our source + (<filename>src</filename>) and bytecode + (<filename>bin</filename>) file hierarchy.</title> + </info> + + <mediaobject> + <imageobject> + <imagedata fileref="Ref/Fig/packageHierarchy.png"/> + </imageobject> + </mediaobject> + </screenshot> + </figure> + </answer> + </qandaentry> + </qandadiv> + </qandaset> + <qandaset defaultlabel="qanda" xml:id="sw1QandaEmployeeConstructorThis"> <title>Constructors variable names and <quote>this</quote>.</title> -- GitLab