670 likes | 863 Views
Introduction to Software Engineering: Tools and Environments. Session 9. Oded Lachish Room: Mal 405 Visiting Hours: Wednesday 17:00 to 20:00 Email: oded@dcs.bbk.ac.uk Module URL: http://www.dcs.bbk.ac.uk/~oded/Tools2012-2013/Web/Tools2012-2013.html. Previously.
E N D
Introduction to Software Engineering: Tools and Environments Session 9 Oded Lachish Room: Mal 405 Visiting Hours: Wednesday 17:00 to 20:00 Email: oded@dcs.bbk.ac.uk Module URL: http://www.dcs.bbk.ac.uk/~oded/Tools2012-2013/Web/Tools2012-2013.html
Previously • Introduction to Build Tools (Ant) Today’s session • Introduction to Documentation Tools • Doxygen • eUML2 • Build Tools revisited • Introduction to Integration Tools
Documentation Tools
Documentation Tools • Extreme programmers believe that • “code is self documenting” • Maintenance is usually the longest part of a software products life • Regretfully there is a rumour that a large portion of the Hi-Tech jobs require the ability to do so. • Now imagine that you have to do the job without any documentation • Solution: Automation – dedicated tools
Documentation Tools • What can documentation tools do for us? • Generate class diagrams (UML) – depicts the static relations between classes • Collaboration diagrams (UML) – depicts classes and their interactions • Search engine to code • and much more • When are these tools used? • As soon as possible (definitely before you need reverse engineering).
Doxygen A documentation system for C++, C, Java, Objective C, Fortran, VHDL, PHP, C#. • What can it do for us? • Generate on-line documents in HTML • Generate an off-line manual – latex, RTF (MS-Windows) • What does that include? • Dependency graphs • Inheritance diagrams • Collaboration diagrams • User specified information
Doxygen • How does Doxygen generate all this information? • Doxygen can extract the code structure from the source files. • The user specified information is also generated from the source files, specifically from comments. • The underlying approach is to minimize the documents you need to create and simplify the process of updating them. If you update the comments when you update the code then the documentations also get updated.
Doxygen Installation • Regretfully Doxygen is not an Eclipse plug-in • Download from: http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc • Double click the downloaded file • The rest of the installation is standard
Doxygen – preparing example code Lets start a new project Project name: Example10 Create one package named: allMyClasses Create a Junit test: TutorTest “TutorTest” should instantiate a class named Tutor with a constructor that accepts a string as a parameter and then call its method “whatYourName()” Snippets of the resulting code appear in the following slides
Code for demonstration Tutor.java TutorTest.java package allMyClasses; /** * @author oded * */ public class Tutor { private String name; public Tutor(String string) { super(); name = string; } public void whatIsYourName() { System.out.println(name); } } package allMyClasses; import org.junit.Test; /** * @author oded * */ public class TutorTest { @Test public void test() { Tutor t= new Tutor("Oded"); t.whatIsYourName(); } }
Doxygen- Mode Options Press
Doxygen- Output Options Press
Doxygen- Run menu Press
Doxygen- the “index.html” file
Doxygen- allMyClasses.Tutor From comment
Doxygen- allMyClasses.Tutor changed comment The comment Now: save file and rerun Doxygen
Doxygen- allMyClasses.Tutor changed name From comment
Adding code to example Use refactoring to extract interface from class “tutor” Person.java package allMyClasses; public interface Person { public abstract void whatIsYourName(); } Now: save file and rerun Doxygen
Doxygen Create a new class that implements Person Teacher.java package allMyClasses; /** * @author oded * */ public class Teacher implements Person { private String name; public Teacher(String name) { super(); this.name = name; } /* (non-Javadoc) * @see allMyClasses.Person#whatIsYourName() */ @Override public void whatIsYourName() { System.out.println(name); } }
Doxygen Create a new class that implements Person TutorTest.java package allMyClasses; import org.junit.Test; /** * @author ooded * */ public class TutorTest { @Test public void test() { Person classUnderTest= new Tutor("Oded"); Person classUnderTest2= new Teacher("Lance"); classUnderTest.whatIsYourName(); classUnderTest2.whatIsYourName(); } } Now: save file and rerun Doxygen
Doxygen – documenting code • In order to know which comments are for Doxygen the comment must have some additional marking (different marking for different languages) • JavaDoc Style marking, • for detailed description • (needs to be placed • before the member) • JavaDoc Style marking • for detailed description • (needs to be placed • before the member) required /** * …This does not do much… */ required /**< The name of the object */
Doxygen – comment • One can also specify exactly where the comment belongs • “\enum” - to document an enumeration type • “\file” - to document a file • “\package” - to document a Java package. • “\interface” - to document an IDL interface • Formats /*! \file Teacher.java is a java file */ /*! @file Teacher.java is a java file */
Doxygen – not just inheritance diagrams Regretfully this requires another tool graphviz needed to generate more advanced diagrams and graphs. (open-source, cross-platform graph drawing toolkit be http://www.graphviz.org/ )
Doxygen – other important features • Searching • Linking to external documentation • Customizing output • How to add support for new languages • Automatic link generation • Including formulae
eUML2 • UML – unified modeling language- • Standardized general purpose modelling language for OO analysis and design. • eUML2 – a UML2 framework for eclipse
eUML2 - installation eUML2 can be found at eclipse marketplace
eUML2 – reverse engineering Right click project
eUML2 – UML model Press
eUML2 – What Happened? Press Press
eUML2 – What Happened? Press Press
eUML2 – Diagram Options Press
eUML2 – class diagram You can actually write code by editing the diagram. TRY it OUT!
Build Tools Revisited