• No results found

Software infrastructure for Java development projects

N/A
N/A
Protected

Academic year: 2021

Share "Software infrastructure for Java development projects"

Copied!
83
0
0

Loading.... (view fulltext now)

Full text

(1)

Tools that can optimize

Tools that can optimize

your development

your development

process

process

Software infrastructure for

Java development projects

(2)

Presentation plan

Presentation plan

•Software Development Lifecycle Tools

● What tools exist?

● Where can tools help?

•Practical Applications

● How are these tools used in the real world?

● Work of the O2C2 group at Inland Revenue to improve the

(3)

The Java Power Tools Book

(4)

•Tools to optimize the Java SDLC

•Main author: John Smart

•Supported by Equinox

•Published by O'Reilly

•Contributions from lots of authors

•Website:

http://www.javapowertools.com

The Java Power Tools Book

(5)

Inland Revenue and O2C2

Inland Revenue and O2C2

• Inland Revenue

• Carries out a large number of internal and external Java-based developments

• O2C2:

The Object Oriented Competency

Centre

● Provide coaching and technical

expertise in Java development

● Optimize development practices and

(6)

Types of tools

Types of tools

• Many tools exist

• Different tools are useful for different tasks

● What tools exist?

● Where can tools help?

(7)

Types of tools

Types of tools

• Let's define some categories:

● Build Process tools

● Version Control tools

● Continuous Integration tools

● Quality Metrics and code audit tools

● Unit Testing and Test Coverage tools

● Integration, Functional, Load and Performance Testing tools

(8)

Types of tools

Types of tools

• Let's define some categories:

Build Process tools

● Version Control tools

● Continuous Integration tools

● Quality Metrics and code audit tools

● Unit Testing and Test Coverage tools

● Integration, Functional, Load and Performance Testing tools

(9)

Build Tools

Build Tools

• The cornerstone of the SDLC process:

● Make your builds reproducible

● Make your builds portable

● Allows you to automate your build process

(10)

Ant

Ant

• A procedural build scripting tool

● Well-known and widely-used

● Powerful and flexible

● Lots of plugins

● Needs lots of low-level plumbing code

(11)

Maven 2

Maven 2

• A declarative build scripting framework

● Higher level scripting

● Strong use of standards and conventions

● “Convention over Configuration”

● Lots of plugins

● Good reporting features

(12)

A Standard Directory Structure

A Standard Directory Structure

(13)

Standard lifecycle

Standard lifecycle

• A s

tandard development lifecycle

compile test integration-test install deploy test-compile package

(14)

Standard Build Commands

Standard Build Commands

• Maven 2 - standard build commands

$ mvn compile $ mvn test $ mvn package $ mvn deploy

...

compile test integration-test test-compile package

(15)

Dependency Management

Dependency Management

• Declarative Dependency Management

● Important feature of Maven 2

(16)

Traditional Dependency Management

Traditional Dependency Management

• Traditional approach – JAR files stored in CVS

● Each project has its own set of JAR files

● Unnecessary duplication

● Hard to keep track of versions

● Errors due to incompatible JARs

(17)

Traditional Dependency Management

Traditional Dependency Management

I need these JARs for my project

I need some too

Internet

Individual Project websites CVS

(18)

Declarative Dependency Management

Declarative Dependency Management

• Declarative dependency management

● Versioned JARs stored on a central server

● Each projects “declares” what libraries it needs

(19)

Declarative Dependency Management

Declarative Dependency Management

I need Hibernate 3.2.4 I need Spring 2.0.6 Internet Public repositories Enterprise Maven Repository cache 2.0.6 3.2.4 2.4 1.0 1.2.16 2.0.1 1.4 1.8

(20)

The Enterprise Maven Repository

The Enterprise Maven Repository

• An Enterprise Maven Repository

● Acts as a proxy/cache for downloaded

dependencies

● Faster and more reliable than always going to

the internet

(21)

Maven 2 Reporting

Maven 2 Reporting

• Maven 2 - reporting

(22)

Types of tools

Types of tools

• Categories of tools

● Build Process tools

Version Control tools

● Continuous Integration tools

● Quality Metrics and code audit tools

● Unit Testing and Test Coverage tools

● Integration, Functional, Load and Performance Testing tools

(23)

1.0 1.1 1.2

1.1.1

Version Control Tools

Version Control Tools

• Version control tools provide:

● A central storage for source code

● Backups and change history

● Identify versions and releases

(24)

CVS

CVS

• A venerable open source version control tool

• Starting to show its age:

● No atomic commits

● Poor support for non-binary files

● Difficult to rename or move directories

(25)

Subversion

Subversion

• Designed to replace CVS

• Better adapted to Java development:

● Atomic commits

● Good support for binary files

(26)

Subversion

Subversion

• Has some nice advanced features:

• HTTP / WebDAV support

• Windows integration (TortoiseSVN) • Web interface (Trac)

(27)

Types of tools

Types of tools

• Categories of tools

● Build Process tools

● Version Control tools

Continuous Integration tools

● Quality Metrics and code audit tools

● Unit Testing and Test Coverage tools

● Integration, Functional, Load and Performance Testing tools

(28)

Continuous Integration

Continuous Integration

• Integrate early, integrate often:

● Automate the build process

● Minimise code integration issues

● Improve visibility on the development process

(29)

Continuous Integration

Continuous Integration

• The “Traditional” development process:

● Coding

● Maybe some unit tests

● Integration

● System and UAT testing

(30)

The traditional approach

The traditional approach

Version control (CVS)

Infrequent commits

Difficult integration process

Infrequent releases Lots of bugs

(31)

• A flawed process:

● Testing may not be done efficiently

● Integration is long and difficult

● Poor visibility on development progress

● Functional tests are done too late

● Raised issues are harder to fix

● The client gets a sub-optimal product

The traditional approach

(32)

How Continuous Integration helps

How Continuous Integration helps

Dedicated build server Version control (CVS)

Regular commits

Fast notification of integration issues Smother integration

Regular testing

(33)

Advantages of Continuous Integration

Advantages of Continuous Integration

• An industry best practice

● Smoother integration

● Automatic regression testing

● Regular working releases

● Earlier functional testing

● Faster and easier bug fixes

(34)

Continuous Integration tools

Continuous Integration tools

• Many choices

● CruiseControl ● LuntBuild ● Continuum ● Hudson ● ...

• Some commercial tools are also available, for exampe:

(35)

Continuous Integration tools

Continuous Integration tools

• CruiseControl

● Mature tool

● Strong user base

● Lots of extensions

(36)

Continuous Integration tools

Continuous Integration tools

• LuntBuild

● Web-based, easy to use

(37)

Continuous Integration tools

Continuous Integration tools

• Continuum

● Web-based, easy to use

● Not as feature-rich as the others

(38)

Continuous Integration tools

Continuous Integration tools

• Hudson

● Web-based, easy to use

● Lots of plugins

(39)

The Hudson CI Server

The Hudson CI Server

(40)

The Hudson CI Server

The Hudson CI Server

(41)

The Hudson CI Server

The Hudson CI Server

Notification by email

When a build fails

When it is fixed

(42)

The Hudson CI Server

The Hudson CI Server

(43)

The Hudson CI Server

The Hudson CI Server

View changes in a particular build

Tag a build in CVS

(44)

Types of tools

Types of tools

• Categories of tools

● Build Process tools

● Version Control tools

● Continuous Integration tools

Quality Metrics and code audit tools

● Unit Testing and Test Coverage tools

● Integration, Functional, Load and Performance Testing tools

(45)

Quality Metrics

Quality Metrics

• Why enforce coding standards?

● Better quality code

● Code is easier to maintain

● Detect potential bugs

(46)

Quality Metrics

Quality Metrics

• Manual code reviews are good, but...

● Slow and time-consuming

● Tend not to be done systematically

• Automatic code audits

• Automatically enforce organisation coding standards • Detect bad coding practices and potential bugs

(47)

Quality Metrics tools

Quality Metrics tools

• We use three complementary tools

Checkstyle – coding standards

PMD – best practices

(48)

Quality Metrics

Quality Metrics

Checkstyle - Enforce coding standards

● Formatting and indentation

● Naming conventions

● Javadocs

(49)

Quality Metrics

Quality Metrics

Checkstyle - Enforce coding standards

(50)

Quality Metrics

Quality Metrics

Checkstyle - Enforce coding standards

(51)

Quality Metrics

Quality Metrics

Checkstyle - Enforce coding standards

(52)

Quality Metrics

Quality Metrics

PMD – Best practices

● Empty try/catch/finally blocks

● Incorrect null pointer checks

● Excessive method length or complexity

● etc...

(53)

Quality Metrics

Quality Metrics

PMD – Best practices

(54)

Quality Metrics

Quality Metrics

PMD – Best practices

(55)

Quality Metrics

Quality Metrics

PMD – Best practices

(56)

Quality Metrics

Quality Metrics

FindBugs – Potential defects

● Potential NullPointerExceptions

● Infinite loops

(57)

Quality Metrics

Quality Metrics

FindBugs – Potential defects

(58)

Quality Metrics

Quality Metrics

FindBugs – Potential defects

Maven reports

(59)

Quality Metrics

Quality Metrics

FindBugs – Potential defects

(60)

Types of tools

Types of tools

• Categories of tools

● Build Process tools

● Version Control tools

● Continuous Integration tools

● Quality Metrics and code audit tools

Unit Testing and Test Coverage tools

● Integration, Functional, Load and Performance Testing tools

(61)

Unit Testing

Unit Testing

A recommended best practice

Unit testing results in:

● More reliable code

● Better designed code

(62)

Unit Testing Tools

Unit Testing Tools

Main tools

JUnit 3.x – the original, with lots of extensions

JUnit 4 – annotations and stuff

(63)

Unit Testing in Eclipse

Unit Testing in Eclipse

(64)

Test reports

Test reports

(65)

Test result trends

Test result trends

(66)

Test Coverage

Test Coverage

Test Coverage:

● Are unit tests being written for all classes?

● How much code is really executed by the unit tests?

● Un-executed code will contain bugs

Tool used:

(67)

Test Coverage Reports

Test Coverage Reports

(68)

Test Coverage

Test Coverage

(69)

Types of tools

Types of tools

• Categories of tools

● Build Process tools

● Version Control tools

● Continuous Integration tools

● Quality Metrics and code audit tools

Unit Testing and Test Coverage tools

Integration, Functional, Load and Performance Testing

tools

(70)

Integration, Functional, UI and Perf

Integration, Functional, UI and Perf

Tests

Tests

• Cover all your bases

DBUnit - database testing

● Spring testing framework (Spring MVC) or StrutsTestCase

Eclipse Profiling (TPTP) - profiling

JMeter – load and performance testing

SoapUI – web service testing

Selenium – web interface testing

(71)

User Interface Testing

User Interface Testing

(72)

Regression Testing

Regression Testing

All tests automatically run before each build:

● Unit tests

● Integration tests

(73)

Types of tools

Types of tools

• Categories of tools

● Build Process tools

● Version Control tools

● Continuous Integration tools

● Quality Metrics and code audit tools

Unit Testing and Test Coverage tools

Integration, Functional, Load and Performance Testing tools

(74)

Technical Documentation

Technical Documentation

Human-written documentation:

● (potentially) highest possible quality

BUT

● Often incomplete

(75)

Technical Documentation

Technical Documentation

Automatically-generated documentation:

● Complete ● Always up-to-date ● Cheap to produce ●

BUT

(76)

Technical Documentation

Technical Documentation

Many tools available:

Maven web site – lots of reports and project info

SchemaSpy – database schemas

Doxygen – UML documentation

(77)

Technical Documentation

Technical Documentation

Maven web site

● Rich reporting capabilities

● General project information

(78)

Technical Documentation

Technical Documentation

SchemaSpy

(79)

Technical Documentation

Technical Documentation

DOxygen

(80)

Technical Documentation

Technical Documentation

UMLGraph

(81)

Technical Documentation

Technical Documentation

Also some human-written documentation – project Wiki

● Architecture vision

● High-level design

(82)

Overview

A Standard Build Process Dependency Management Continuous Integration Continuous Testing Continuous Quality

(83)

References

Related documents

Although client devices that do not support IEEE 802.11r can associate to a BSS with Fast Transition enabled, some client device drivers have been found to be incompatible and

Our study aimed to determine, from a theoretical point of view, the most reliable method for predicting postoperative refraction among 11 possible alternatives: (1) Sim-K gen- erated

Audit division staff provided instruction at two statistical and one income tax training classes during fiscal year end June 30, 2010.. National

As a response to the search for an identity for the school counselor, ASCA (2012) developed the ASCA National Model: A Framework for School Counseling Programs to help answer

Gaseous elemental mercury (GEM), reactive gas phase mer- cury (RGM) and particulate mercury (PHg) concentration measurements from Alert, Canada, from 2002 to 2011 are shown in

 A branded virtual room featuring your company’s logo and sponsorship during exclusive post-event virtual social gathering in Wildlife World.  Top logo recognition in

The inexplicable thing about this is that the balls are solid ivory, which fact the conjurer takes care to impress upon the onlookers by taking one of the three with his disengaged

Resolving Chaos Arising from Timebox Re-directions - 1 1 2 2 3-1 3-1 Implements 3-1 3-2 3-2 3-3 Test Defects Tests not Conducted Unplanned Workarounds Feature Changes Changes in