introduction to software engineering: tools and environments

Click here to load reader

Upload: elata

Post on 24-Feb-2016

68 views

Category:

Documents


0 download

DESCRIPTION

Introduction to Software Engineering: Tools and Environments. Session 8. 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. Last time. - PowerPoint PPT Presentation

TRANSCRIPT

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 81Last timeTools for bug management

After Git this is the second time that we focused on tools that are group specific

2This timeBuild tools

Can be developer specific but their main importance is in a larger context integration and the rest. 22Managing a ProjectsBuildBuild Tools333Building a ProjectThe task of creating something useful (executable)

from the text you call code444Building a ProjectIn the beginning, before GUI, we had command line.There was a time when compilation and linking was done with just command line.But then projects became more and more complexLarge directory structureMany files and file dependenciesVast variety of precompiled librariesThe command line was not sufficient anymore555Build Tools and their Scripting LanguagesA naive solution to the build complexity problemWrite a program for building

A proper solutionBuild a tool with its own scripting languageWhy?A dedicated (and hopefully simple) language for building improves the efficiency of the automation of the build process666But why isnt Building EasyQuestion: Why cant we just tell the compiler where to find all the files and libraries?

Answer: A combination of a large number of filesand dependencies

That was already mentioned, what does it mean?To answer this question we need to know a bit more aboutthe Java complier options777The Java Compiler javac.exeWhat does it do?One of the answers:It reads .java files (java language) and translates them to .class files (java class files containing platform neutral Java bytecode (the language of the java virtual machine (JVM)))

But in skilful hands it can do much more!

8Remark: There are compilers that translate to other languages.88Examining the Java CompilerThere are many manners in which javac can be controlled.Options given as they would be in command line.-d directory - destination directory for class files. Must exist because javac will not create it.-g Generate generate all debugging information, including local variables.-g:none Generate do not generate any debugging information-nowarn Disable - do not generate warning messages.-verbose - print information such as each class loaded and each source file compiled. 999Examining the Java Compiler-classpath path - Specify where to find user class files-sourcepath sourcepath location of source code (path to search) for class or interface definitions

Example:javac -sourcepath src -classpath lib\*.jar \ src\Operations\adder.java -d bin101010Anything more?Of course but more of the same flavour.Q: So why is there any problem?A: For a reasonable answer we need to understand what the compiler does.

When compiling a source file, the compiler may require information about a types whose definition did not appear in the source files given on the command line.When that occurs the compiler searches first for class files!(why?)111111Again?Q: So why is there any problem?A: The problem is not in what there is but in whats missing!

Imagine the project is very big, hundreds to thousands of files.Now youve just changed one little class.You definitely do not want to compile the whole project again!Q: So why dont you tell the compiler to compile only that class?121212Two Classes and DependenciesImagine we changed two classes one a super-class of the other.Now the subclass depends on the super class.So we should tell the compiler to recompile the super-class before the sub-class otherwise the subclass will be recompiled with an old version of the super-class (since we are recompiling we probably told the compiler where the old class files are and that includes the previous version of the super-class) How do we get the compiler to actually take this into account?131313DependenciesDependencies such as described in the previous slides might actually exist between previously compiled classes and even just the one class that we changed!

Things just got complicated.

When changing one class we want to recompile only what we have to!

This is one of the reasons why we need build tools!141414More Reasons for Using Build ToolsPortability - the build process should not depend on the IDE (which did the job for us until now) the same code may give different compilation results on different IDEs.Automation (as usual)Build tools can do much more than orchestrating the compilation. For example, they can be used to execute tests, for actual deployment and many other things.They may also look for the proper libraries151515Back to dependenciesCan you guess what can be done to overcome this problem?

161616Ant and MavenOpen source tools for building a project and sometime a lot more.Both abstract away the dependencies issueBoth are available as plug-ins for eclipse

Both tools use XML for configuring

Maven and Ant differ significantly in their approach171717XML181818What is XML?The eXtensible Markup Language (XML) defines ageneric syntax used to mark up data with simple, human-readable tagsHas been standardized by the World Wide WebIs flexible enough to be customized for domains as diverse as:Web sitesElectronic data interchangeVector graphics191919What is XML?Data in XML documents is represented as strings of textThis data is surrounded by text markup that describes the data ( Alan Turing )A particular unit of data and markup is called an elementXML specifies the exact syntax of how elements are delimited by tags, what a tag looks like, what names are acceptable, and so on202020Elements, Tags, and DataA very simple, yet complete, XML document:

Alan Turing

Composed of a single element whose type is personElement is delimited by the start tag and the end tag Everything between the start tag and end tag (exclusive) is the elements content212121Elements, Tags, and Data(2)Content of the above element is the text string Alan TuringWhitespace is part to the content (although many applications choose to ignore it) and are markup,The string Alan Turing and surrounding whitespace are character data222222Entity ReferencesCharacter data inside an element may not contain a rawunescaped opening angle bracket