Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Improve your codebase with WebSphere Studio Application Developer

WebSphere tools make refactoring easy

David Carew (carew@us.ibm.com), E-business Architect, IBM
David Carew is a senior e-business architect for IBM Developer Relations Technical Consulting in Austin, Texas, providing education, enablement, and consulting to IBM business partners. He joined IBM in 1988 and has held a variety of positions in development, from writing the code to control industrial robots to writing device drivers for AIX Wide Area Network devices. Somewhere along the way he learned Java, picked up an MBA from the University of Texas at Austin, and started consulting for Developer Relations. David is a Sun Certified Java Programmer, a Certified Java Developer, and a Certified Architect for Java Technology. You can contact him at carew@us.ibm.com.
Sandeep Desai (sandeep@us.ibm.com), E-business Architect, IBM
Sandeep Desai is an e-business architect in IBM's Developer Relations Technical Consulting group in Austin, Texas. He works with IBM's business partners -- small or large companies, from startups to large firms -- helping them get excited, evangelized, educated, and enabled on IBM's e-business platform. Sandeep holds the following technical certifications, among others: IBM Certified E-business Solution Advisor, IBM Certified E-business Solution Designer, IBM Certified E-business Solution Technologist, IBM Certified Specialist -- WebSphere Application Server, and IBM Certified Systems Expert -- WebSphere Application Server. You can reach him at sandeep@us.ibm.com.
Anthony Young-Garner (ajyoung@us.ibm.com), Software Engineer, IBM
Anthony Young-Garner is a software engineer at IBM Austin, assisting developers in coding and deploying applications on WebSphere Application Server. Contact him at ajyoung@us.ibm.com.

Summary:  Instead of writing new applications from scratch, much of a developer's job today involves changing existing code. Simple changes may consist of adding on to the existing code. However, as multiple revisions or extensive changes are made, the internal structure of the software may begin to deteriorate. It can become difficult to understand, and expensive to modify and maintain. That is why it is important to know how to refactor code. Refactoring is changing the internal structure of software to make that software easier to understand and cheaper to modify without changing its observable behavior. In this tutorial, you'll learn about features in WebSphere Studio Application Developer that make refactoring easy.

Date:  19 Aug 2003
Level:  Introductory PDF:  A4 and Letter (113 KB | 36 pages)Get Adobe® Reader®

Activity:  2754 views
Comments:  

Before you start

About this tutorial

Instead of writing new applications from scratch, much of a developer's job today involves changing existing code. Simple changes may consist of adding on to the existing code. However, as multiple revisions or extensive changes are made, the internal structure of the software may begin to deteriorate. It can become difficult to understand, and expensive to modify and maintain. That is why it is important to know how to refactor code. Refactoring is changing the internal structure of software to make that software easier to understand and cheaper to modify without changing its observable behavior. In this tutorial, you'll learn about features in WebSphere Studio Application Developer that make refactoring easy.


Who should take this tutorial?

This tutorial assumes that you have experience developing applications with the Java platform. Experience with WebSphere Studio Application Developer (sometimes referred to in this tutorial as Application Developer) is helpful but is not required.

The focus of this tutorial is the refactoring of Java applications using JUnit and the refactoring tools available in Application Developer. If you are unfamiliar with JUnit, you may benefit from completing an earlier WebSphere Developer Domain tutorial, Keeping critters out of your code (see Resources ). We also encourage you to learn more about JUnit and Application Developer after completing this tutorial; see Resources for suggested reading.


Required software

You'll need the following software installed on your system to complete the steps in this tutorial:

  • WebSphere Studio Application Developer, Version 5.0.
  • goforit2.zip. This is a small slice of the Go-ForIt application, which we'll use as a starting point for the tutorial. The zip archive contains a set of incomplete Java classes that we'll test and complete. You can download this package to your own system for reference.

Our sample application

The GoForIt application was developed by the IBM Developer Relations Technical Consulting team using extreme programming (XP). It is a Web site for the fictitious company Go-ForIt.com, which is a personal errand service. A customer registers at the site and posts an errand that needs to be done, such as picking up laundry, walking the dog, standing in line at the driver's license bureau, and so on. Independent contractors known as personal assistants (PAs) can also register at the site and bid on posted errands. Go-ForIt.com matches up the winning bid with the customer in need and collects a percentage of the fee paid for completion of the errand.

One of the tenets of extreme programming is test-driven development. Test-driven development requires that functional tests be written before functional code. Development effort is then focused on ensuring that all tests are passed.


What is refactoring?

In his influential book Refactoring: Improving the Design of Existing Code (see Resources), Martin Fowler offers a pair of useful definitions:

  • A refactoring is a change in the internal structure of software that makes that software easier to understand and cheaper to modify without changing its observable behavior.
  • To refactor is to restructure code by applying a series of syntactic changes without changing the code's observable behavior.

JUnit

JUnit, a unit-testing framework for the Java language, is an open source project begun by Kent Beck and Erich Gamma. It is the most well-known testing framework in the Java developer community and has also been ported to many other languages.


WebSphere Studio Application Developer

WebSphere Studio Application Developer is IBM's premier integrated development environment (IDE) for J2EE developers and Java programmers. It is based on the WebSphere Studio Workbench, IBM's tool integration platform. WebSphere Studio Workbench is in turn built on the open source Eclipse platform. Eclipse.org (see Resources) is a consortium of development tool providers working to provide a common platform for seamless integration of tools from different vendors.

Application Developer's user interface is centered around the idea of perspectives. A perspective is a group of related views and editors. Application Developer contains several perspectives intended for role-based development. For example, a Web developer might use the Web perspective, while an EJB developer might use the J2EE perspective.

1 of 11 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=142928
TutorialTitle=Improve your codebase with WebSphere Studio Application Developer
publish-date=08192003
author1-email=carew@us.ibm.com
author1-email-cc=
author2-email=sandeep@us.ibm.com
author2-email-cc=
author3-email=ajyoung@us.ibm.com
author3-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.