introduction to software engineering: tools and environments
DESCRIPTION
Introduction to Software Engineering: Tools and Environments. Session 9. Oded Lachish Room: Mal 405 Visiting Hours: Wednesday 17:00 to 20:00 Email: [email protected] Module URL: http://www.dcs.bbk.ac.uk/~oded/Tools2012-2013/Web/Tools2012-2013.html. Previously. - PowerPoint PPT PresentationTRANSCRIPT
Introduction to Software Engineering: Tools and Environments
Oded Lachish
Room: Mal 405 Visiting Hours: Wednesday 17:00 to 20:00Email: [email protected] URL:http://www.dcs.bbk.ac.uk/~oded/Tools2012-2013/Web/Tools2012-2013.html
Introduction to Software Engineering: Tools and EnvironmentsSession 91Introduction to Build Tools (Ant)2PreviouslyTodays sessionIntroduction to Documentation ToolsDoxygeneUML2Build Tools revisitedIntroduction to Integration Tools22Documentation Tools333Extreme programmers believe thatcode is self documentingMaintenance is usually the longest part of a software products lifeRegretfully 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 tools4Documentation Tools44What can documentation tools do for us?Generate class diagrams (UML) depicts the static relations between classesCollaboration diagrams (UML) depicts classes and their interactionsSearch engine to codeand much moreWhen are these tools used?As soon as possible (definitely before you need reverse engineering).5Documentation Tools55Doxygen666DoxygenA documentation system for C++, C, Java, Objective C, Fortran, VHDL, PHP, C#.7What can it do for us?Generate on-line documents in HTMLGenerate an off-line manual latex, RTF (MS-Windows)What does that include?Dependency graphsInheritance diagramsCollaboration diagramsUser specified information77Doxygen8How 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.88Doxygen Installation9Regretfully 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 standard99Doxygen preparing example code10Lets start a new projectProject name: Example10Create one package named: allMyClassesCreate a Junit test: TutorTestTutorTest 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 slides1010Code for demonstration11
package allMyClasses;import org.junit.Test;
/** * @author oded * */public class TutorTest {@Testpublic void test() {Tutor t= new Tutor("Oded");t.whatIsYourName();}}TutorTest.javapackage allMyClasses;/** * @author oded * */public class Tutor { private String name; public Tutor(String string) {super();name = string; } public void whatIsYourName() {System.out.println(name); }}Tutor.java1111Doxygen GUI front end12
1212Doxygen- Selecting Directories13
Press1313Doxygen- Mode Options14Press
1414Doxygen- Output Options15
Press1515
Doxygen- Diagram option161616
Doxygen- Expert (maybe later)171717Doxygen- Run menu18
Press1818Doxygen- directory before and after19
1919Doxygen- the index.html file20
2020Doxygen- allMyClasses.Tutor21
From comment2121
Doxygen- allMyClasses.Tutor changed comment22The commentNow: save file and rerun Doxygen2222
Doxygen- allMyClasses.Tutor changed name23From comment2323Doxygen- class members24
2424Doxygen- packages25
2525Doxygen- file list26
2626Adding code to example27Use refactoring to extract interface from class tutorpackage allMyClasses;
public interface Person {
public abstract void whatIsYourName();
}Person.javaNow: save file and rerun Doxygen2727Doxygen class hierarchy28
2828Doxygen inheritance diagram 29
2929Doxygen30Create a new class that implements Personpackage 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); }}Teacher.java3030Doxygen31Create a new class that implements PersonTutorTest.javapackage 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 Doxygen3131Doxygen with new class32
3232Doxygen documenting codeIn 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 placedbefore the member)
JavaDoc Style markingfor detailed description(needs to be placedbefore the member)
33/** * This does not do much*/required/**< The name of the object */required3333Doxygen detailed description comment (before format)34
3434
Doxygen detailed description comment (after format)353535Doxygen comment36One 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 */3636Doxygen file comment37
3737Doxygen not just inheritance diagrams38Regretfully 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/ )
3838Doxygen other important features39Searching Linking to external documentationCustomizing outputHow to add support for new languagesAutomatic link generationIncluding formulae3939eUML2404040eUML2UML unified modeling language-Standardized general purpose modelling language for OO analysis and design.
eUML2 a UML2 framework for eclipse 414141eUML2 - installationeUML2 can be found at eclipse marketplace42
4242eUML2 reverse engineeringRight click project43
4343eUML2 UML model44
Press4444eUML2 What Happened?45
Press
Press4545eUML2 What Happened?46
Press
Press4646eUML2 Diagram Options47Press
4747eUML2 Package Content Selection48Press
4848eUML2 class diagram49
You can actually write code by editing the diagram. TRY it OUT!4949Build ToolsRevisited505050Ant revisited - depend51
Now compile twice, then change (add space) Person Interface and compile again5151Ant ScriptShould have recompiled all the classes52
5252Ant - depend53
Change (remove space) Person Interface and compile again5353Ant with New ScriptAll dependent class files were deleted, and then all files were recompiled like the should.Lets check if it doesnt just delete all54
5454Ant doesnt just delete allDid not just delete all55
5555How does Ant know what to deleteUses information inside class files in order to determine dependencies
Uses file time stamp to check whether java code is newer than compiled code565656Why Ant is not Good for Large ProjectsScalability problems choice of XML is too restrictedMaintainabilityManaging package dependencies575757Next Stage585858Until nowWe have covered many SDLC tools from a single developer s point of view.
59LocalIndividualDeveloper
IntegrationCollected work of IndividualDevelopers
TestingQA teamEnvironment
Project point of view(large project) From here on5959Single Developers Toolslight weightEasy to learnIntegrated with IDETrivial to install and set
Massive number of available tools
60Project Scale ToolsHEAVYEasy to learn?Require their own serverInstallation may require significant effortRelatively small variety of tools
6060Continuous Integration616161IntegrationWhere all the code goes to (and also the unit tests)
Here when things go wrong the price is high
That is why the focus is on want to minimizing the damage when things go wrong626262Continuous IntegrationIntegrate code as soon as possible.Why?
Each time only a small portion of code is added or changed. Why?
Problems are detected earlierEasier to find the problem636363Jenkins646464What is JenkinsA crucial element in continuous integration with two main goals:
Continuously build and test software projects
Monitor externally run jobs656565Work Flow with JenkinsA team member/ members commit code to source control repository66Jenkins detects that new code has been committedJenkins uses Build Tools to build the project and Test tools to test the project Jenkins uses the resulting files to generate reportsJenkins send notification if anything went wrong (build, test failed etc.)6666Jenkins as Part of the Big PictureAn easy to configure tool that is responsible for the following:
Make sure that everything that should be executed is executed when and as soon as possible
Collect all the information and process it into coherent reports (imagine have 10 different tools each with its own report)
676767