Project Management: Techniques & Tools - Integrated Development Environments (IDEs)

farrightΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 2 μήνες)

398 εμφανίσεις

Project Management: Techniques & Tools

60
-
499

Development Tools

Integrated Development Environments

Why use an IDE?


A text editor is adequate for developing assignments


However, an IDE is essential for real
-
world projects:


Multiple file management


Integrated compilation and execution


Syntax highlighting


Auto
-
completion


Debugger


Maintenance features (e.g. refactoring)

Popular Java IDEs


Eclipse (free, http://eclipse.org)


The current de
-
facto standard for Java IDEs


Extensive set of plug
-
ins for JavaEE, UML, web applications, persistence


Also supports: AspectJ, C, C++, COBOL, PHP


Borland JBuilder (not free, http://www.borland.com)


Extensive support for JavaEE, web applications, persistence


Sun NetBeans (free, http://www.netbeans.org)


Not
-
free version "Java Studio Creator" adds additional webdev support


Limited support for JavaEE, web applications, persistence


IBM Rational Application Developer (not free, http://www.ibm.com)


Extensive support for JavaEE, web applications, SOA, persistence


Integration with IBM WebSphere application server


BEA WebLogic Workshop (not free, http://www.bea.com)


Extensive support for JavaEE, web applications, persistence


Integration with BEA WebLogic application server


Oracle JDeveloper (free, http://www.oracle.com)


Extensive support for JavaEE, web applications, persistence


Integration with Oracle application server

Eclipse


Multiple file manager


Projects with several files are well
-
suited for IDEs, since the IDE can
compile/save multiple files at once


Debugger


You need a debugger when looking at someone else’s code!


Refactoring


You can make changes more easily


Ant integration


You can still use Ant as your build tool


This will be discussed later


JUnit integration


Built
-
in support for making new tests and invoking them


This will be discussed later, also


Plug
-
ins


Plug
-
ins for UML, web page editing and many others have been developed for
Eclipse and are very stable


e.g. Subclipse is an Eclipse plug
-
in for using Subversion within Eclipse


JavaEE integration


Built
-
in support for Enterprise Java Beans, Java Server Faces, etc.


Eclipse Projects


When you create an eclipse project:


The project wizard starts up, which can generate much of the
scaffolding code


e.g. main method, Javadoc comments, packages


You can create more classes and other components, and they
are added to the project


Creating classes and other components are easier too, since
scaffolding code can be added for these also (e.g. constructors)


When you build:


Eclipse re
-
compiles all files that have changed since the last
compile


When you “Save All”:


All the files in the project are saved

Creating a Project in Eclipse

Creating a Class in Eclipse

Creating a Class in Eclipse

Debugging in Eclipse


To debug a project, add a breakpoint

Debugging in Eclipse


To debug a project, add a breakpoint


Click the Debug icon

Debugging in Eclipse


To debug a project, add a breakpoint


Click the Debug icon


View variable values

Refactoring in Eclipse


Refactorings are changes to a program


e.g. You may decide that your code is too long, so you want to
re
-
design it


Eclipse can make many common refactorings easier


Just to name a few:


Extract constant (hard
-
coded) values


Extract code into its own method


Convert public fields into accessor methods


Extract code into a parent class


Generate an interface from a class


Add a factory to create instances of classes

Refactoring in Eclipse


Let’s move the selected code into its own method:

Refactoring in Eclipse


Let’s move the selected code into its own method:

Refactoring in Eclipse


Let’s move the selected code into its own method:

Project Management: Techniques & Tools

60
-
499

Development Tools

Build Tools

Why Build Tools?


An IDE can compile/run your project in one operation


What if you want to do more than just compile or run?


Generate documentation


e.g. Javadoc


Check code for compliance to coding standards


e.g. Checkstyle


Automatically pretty print code to some common standard


e.g. Jalopy


Update the source control repository’s version of the files that
have changes


Retrieve new versions of other files from source control


e.g. CVS, Subversion, SourceSafe


Deploy a website to an application server


e.g. WebLogic, WebSphere, Tomcat, Oracle app server


Generate installation packages


e.g. tarballs, RPMs, ZIP files, self
-
extracting ZIP files, InstallShield

Build Tools


There are a few common build tools in use in industry:


make


Simple script that describes exactly how to build the program


Ant


Takes an XML configuration file as input


Configuration tasks can include, but are not limited to:


Compilation


Execution


Running tests


Interaction with source control repositories


Interaction with databases


Generation of JAR, ZIP, Tarball files


Deployment to an application server


Execute arbitrary commands/scripts/programs


Maven


An extension to Ant, providing dependency download, report generation, etc.


NAnt


A port of Ant for .NET platforms (e.g. C#)


There are ports for many other platforms as well


e.g. For Ruby: Rant


e.g. For Python: PyAnt

Ant Build Files

<?xml version="1.0" ?>

<project default="compile">


<property name="dir.source" value="src"></property>


<property name="dir.build" value="build"></property>



<target name="compile"


description="Compiles all Java source code">


<echo>Source dir: ${dir.source}</echo>


<echo>Destination dir: ${dir.build}</echo>


<javac srcdir="${dir.source}" destdir="${dir.build}" />


</target>

</project>

Ant Build Files

<?xml version="1.0" ?>

<project default="compile">


<property name="dir.source" value="src"></property>


<property name="dir.build" value="build"></property>


<property name="dir.deploy" value="deployable"></property>



<target name="prepare">


<mkdir dir="${dir.build}" />


<mkdir dir="${dir.deploy}" />


</target>



<target name="compile" depends="prepare"


description="Compiles all Java source code">


<echo>Source dir: ${dir.source}</echo>


<echo>Destination dir: ${dir.build}</echo>


<javac srcdir="${dir.source}" destdir="${dir.build}" />


</target>



<target name="package" depends="compile"


description="Puts class files into a ZIP">


<zip destfile="${dir.deploy}/myproject.zip"


basedir="${dir.build}"


update="true" />


</target>

</project>

Using Ant in Eclipse


Eclipse has built
-
in support for Ant building


Create a build file with File/New/File

Using Ant in Eclipse


Eclipse has built
-
in support for Ant building


Call the file build.xml

Using Ant in Eclipse


Eclipse has built
-
in support for Ant building


Eclipse opens its Ant editor automatically


Type in a build configuration script

Using Ant in Eclipse


Eclipse has built
-
in support for Ant building


Right click the file, and choose ‘Run As’/‘Ant Build’

Using Ant in Eclipse


Eclipse has built
-
in support for Ant building


The build script executes, with output shown in the
typical location

Using Ant in Eclipse


Eclipse has built
-
in support for Ant building


To pick a non
-
default target, choose ‘Run As’/‘Ant
Build…’ (note the ‘…’)

Using Ant in Eclipse


Eclipse has built
-
in support for Ant building


This brings up a dialog for executing Ant scripts