12
Tue, Nov
5 New Articles

Java Journal: Extreme Programming

Java
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
In my mind, the word extreme evokes images of adrenaline junkies jumping off bridges with bungee cords tied around their ankles or snowboarders leaping from helicopters to the top of some far away peak in New Zealand and then carving their way down slopes that most people would call cliffs. So when I first saw the term extreme programming, I was puzzled; the words just didn't seem to belong together. After all, programming is a conservative endeavor and rarely involves jumping off bridges or out of helicopters, so I determined to dig a little deeper into this oxymoron, and here is what I found.

What Is Extreme Programming?

At its core, extreme programming is a software development discipline. What makes it unique is that it evolved from careful scrutiny of existing methodologies and practices, determining their flaws and then correcting them. The extreme in extreme programming comes from these corrections, because they are not subtle. The basic idea is that if something is good, don't just do it more often, do it all the time. Extreme programming is based on a set of principles that change the way you write every line of code.

There are four basic principles of extreme programming:

  • Communication
  • Simplicity
  • Feedback
  • Courage

Communication

Communication is critical in all software development, so extreme programming takes several basic steps to insure good communication. First, the teams are small, with fewer than 10 developers--ideally, five to six. Information flows freely and with little distortion in groups of this size. Second, the daily "stand up" meetings not only encourage communication, but actually force it. The daily "stand up" meeting is exactly as it sounds: It occurs every day at the same time, preferably in the morning, and everybody stands in a circle. Each team member then answers three questions:

  • What did you do yesterday?
  • What are you going to do today?
  • What problems or issues did you run into?


The reason for standing is simple: It not only keeps meeting attendees alert, but also keeps whoever is answering the three questions focused on the topic. Note that the third question is just a statement of the problems or issues that you ran into. Stand-up is not the time to problem solve, but rather a starting point to record problems and determine whether they can be solved by the person working on them currently or they need additional help.

The third way extreme programming promotes good communication is by creating a role within the process for the customer. In most other methodologies, the role of the customer is played by some sort of rather lengthy requirements document. This works; however, it is difficult to ask questions of a document. Instead of lengthy requirements, extreme programming relies on a customer who writes lightweight requirements called stories, is always available to answer questions, attends stand-ups, and writes all the test cases for the system.

The fourth, and probably most controversial, way extreme programming promotes communication is through paired programming. Most software development methodologies recognize peer review of code as being critical. However, most of the time, that either doesn't happen often enough or happens too late in the cycle for any substantive changes to be made. So if peer review is good, it should be done all the time. Paired programming is two people working together on one computer. In other words, paired programming is constant peer review. Good programming pairs talk constantly the whole time they are working together. They discuss different ways of doing things and keep each other from making mistakes or taking shortcuts. Paired programming done right produces very high-quality code and ensures that at least two people understand every part of the system. I will talk more about paired programming under the section on courage.

Simplicity

Simple things work better than complicated things, so extreme programming always chooses the simplest solution. Let's take a look at the basic flow of how a new requirement gets added to the system. First, the customer comes up with the idea for some new piece of functionality and then writes a story card. Story cards are written by hand on 4x6 cards. The customer then writes of series of tests for the new requirement. The programming team breaks down a story into one or more tasks, which are also written on cards, each of which represent a few days of effort. The programming team does all of its work in 2-4 week cycles called iterations, so for each iteration the customer selects which stories will be worked on. When the iteration begins, the programmers write the code and tests for each of the tasks. When all the tests pass for a story, it is considered complete.

I'm sure you have noticed by now that extreme programming relies on cards rather than documents. The reason for this is that cards are more dynamic than documents. Cards take only seconds to create, you can draw little diagrams on them, and you just throw them away if you don't like them. People grow attached to things that they spend time on. Imagine a customer who spends several months perfecting the greatest requirements document ever written vs. a customer who spend a few hours writing up some story cards. Both customers come to a meeting to have their requirements broken down into tasks, and it turns out that half of each of their requirements can't be implemented because of a technical limitation. While both customers will be disappointed at first, there is a pretty good chance that the customer who spent months preparing his documents is going to try to force a less than optimal solution. And even if he doesn't, he will face many hours of updating his documents to reflect what will be done. On the other hand, the customer that used story cards simply files away the stories that couldn't be completed and moves on.

Not only does extreme programming advocate simple solutions, it is itself a simple solution. The first, and in my opinion still the best, extreme programming book is Extreme Programming Explained: Embrace Change by Kent Beck. The book, including an extensive bibliography, is under 200 pages. I've read books on just writing use cases that were twice as long.

Feedback

Although feedback is generally thought of as just a type of communication, it is given its own category in extreme programming, and it happens on many different levels. Since the customer is always available, programmers can give feedback at any time on what is good or bad about their stories. In paired programming, programmers are constantly giving each other feedback on their code. At the end of each iteration, the estimate of how long a task was expected to take is compared with how long it actually took. This information is then used to predict how long similar tasks will take in future iterations. However, the most often overlooked type of feedback is on the code itself. Extreme programming is based on test-first programming. In the case of Java programming, test-first programming almost always involves the use of JUnit or one of its derivatives. JUnit is a simple mechanism for creating automated unit tests for your code. So you write a series of tests, and then you write your code. Once all the tests pass for your task, you are done with the task. For more information on test-first programming, see my article "JUnit: An Automated Test Runner for Java." By using automated testing, you are constantly getting feedback on whether your code works or not.

Extreme programming also advocates frequent integration testing. This means that every time you complete a task, and even when you are still working on it if it is a long one, you integrate all your code. Integration involves checking all your code in to source control, then pulling the entire system from source control to a clean machine where it is built and where every test that exists for the systems is run. If they all pass, you are done; if they don't, you either have to fix the code that breaks a test or back out your integration. Again the best mechanism for doing this in Java is JUnit. Also note again the recurring theme of "if doing it sometimes is good (in this case, testing) then doing it all the time is best."

Courage

Extreme programming both requires courage and gives you courage. Let me explain. First, you need courage in order to convert to extreme programming. It is going to take courage to explain to management why you have two programmers on a single task and how this will be more productive in the long run than just a single programmer working on a task because the quality of the code will be higher and the knowledge base of the team will be more collective. It will also take courage to explain to them that you are replacing their thick binders of product requirements with a bulletin board covered with note cards. However, extreme programming will also give you courage. When things start changing, and they always do, you have a lightweight, nimble process that allows for change. You can add or remove functionality continuously, because your tests are all automated and you don't have to worry about what will this break if you add something.

Benefits

Besides being lightweight and adaptable, extreme programming has several other benefits. For programmers, extreme programming is empowering. It enables programmers to determine how stories map into tasks as well as to give estimates on how long things will take. In addition, the tasks for iteration are not assigned to programmers; rather, programmers choose the tasks they would like to work on. Also, programmers get to work on lots of little tasks and don't get bogged down in schedules that list every task they will be working on for the next six months. Pair programming is also great way to hone your existing skills or pick up new ones. And because of the automated testing in extreme programming, you are free to do lots of refactoring of the code base to introduce design patterns. Most software systems start out organized and slowly degrade into chaos over time. With extreme programming, because of your ability to refactor and add design patterns, the system order can be prevented from degrading and in most cases can even be improved over time. For more information on refactoring and design patterns, please see the following articles: "Java Journal: Refactoring" and "Java Journal: Design Patterns."

For the customers, extreme programming lets them do their favorite thing--change their minds. It also ensures that the programming team is always working on the features that are most important to them first. One amazing benefit to both management and customers is that, since integration testing is always up to date, the system is always in a stable state. So the system is kept in a near shippable state at all times. Management should consider the extreme in extreme programming to stand for extremely conservative. After all, risks are lowered in two ways. First, every part of the system has been worked on by at least two people and in most cases probably by everyone, so there are no dirty little secrets waiting to pop out at the last minute. This also means that after the initial development, you can assign people out to other projects instead of having to keep them all available in case the part of the system that they are an "expert" in has problems. This is also very useful in case somebody gets hit by a bus. It has been my experience that the person most likely to get hit by a bus is the person who not only wrote the most critical part of the system, but also wrote the most convoluted, spaghetti code in the whole system. The second way risk is mitigated is that the system is well-tested and can be proven to work. Another benefit--and from the customer's standpoint, probably the most important benefit--is that systems developed using extreme programming make customers happy.

The Downside

Extreme programming does have a few downsides. It doesn't scale well. If you have too many people on a team, your communication will break down, stand-up meetings will go on too long, and your odds of having problems with people who don't like to pair with each other go up exponentially. Too few people, and you have problems with what to do with the person who doesn't have a partner for pairing. That said, don't let the size of an extreme programming team fool you. I have seen a small extreme programming team pull off projects that I thought would have taken two or three times as many people. Another thing to consider is that many of the most talented programmers I have worked with over the years keep rather odd or irregular hours or even work remotely. For these developers, you have to be flexible. Don't try to force them into showing up for an 8:00 a.m. stand-up five days a week. They will resent the whole process, and it will fail. Extreme programming is geared toward highly dynamic projects with high risk, so it is probably not suitable for lower risk projects with well-defined, static requirements. I'm not sure if I've ever heard of a project of the latter type, but just in case one exists, it's probably not a good extreme programming candidate.

Conclusion

Extreme programming works. It is not just a collection of ideas that some academic scribbled down to sell books. How do I know this? Well, as you probably already know if you are a regular reader of "Java Journal," I have been on an extreme programming team for over two years. The last two years have been simultaneously the most challenging, productive, and rewarding two years of my career. All aspects of extreme programming are based on its four basic principles of communication, simplicity, feedback, and courage. Extreme programming excels where other methodologies fail in that it benefits the programmers, customers, and management equally. Programmers are empowered to do their own estimates, pick their own tasks, and build their skills. Customers get exactly what they ask for and the ability to change their minds and reprioritize as they go. Management gets a high-quality, well-tested system and--best of all--a happy customer. However, extreme programming is not for everyone; it works best with small teams of programmers on highly dynamic, risky projects. It can be hard to sell to management because of the paired programming aspect. In fact, I think the whole thing would have gained better acceptance with management if it had been called "Double Conservative, Ultra Tested, Customer Driven Programming," but then again, with a name like that I probably would never have tried it.

Author's Note: You will see some literature that refers to extreme programming as simply XP; however, this term has fallen out of favor since the release of Windows XP. For more information on extreme programming, see the official site. Or, if you have specific questions for me, feel free to drop me an email or, better yet, post to the forums here at MC Press Online, and I'll do my best to answer them.

Michael J. Floyd is an extreme programmer and the Software Engineering Technical Lead for DivXNetworks. He is also a consultant for San Diego State University and can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

Michael Floyd

Michael J. Floyd is the Vice President of Engineering for DivX, Inc.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: