How to Clean Your Java Functions and Arguments

DZone 's Guide to

How to Clean Your Java Functions and Arguments

· Performance Zone ·
Free Resource
Have you ever been significantly impeded by bad code?  (Uncle) Bob Martin, the CEO of Object Mentor, asked this question at the NDC 2010 conference this year in his first of two major presentations on the subjects of testing and code cleanliness.  If you, or some developer you know is throwing bad code over the wall or passing it off to you, these two presentations will be a blessing to those who think that writing fast and messy code is truly faster.

Developers today need to realize that sacrificing quality to get things out quickly will still cause major delays when that bad code needs to be fixed.  Bob Martin will demonstrate how a Java module can start clean, but gradually degrade in quality, and then be refactored back to a good quality.  

The mindset of "I'll clean it up later" can kill a business.  A company's productivity will gradually decay as the system gets messier and messier, and when the business is forced to do a large-scale redesign, it rarely succeeds.  This presentation is heavy on the code, and it will take you through its cleanup step-by-step.   It's a great experience to see Martin present at a conference because the audience is directly involved in the example where you help Martin clean up a module.  Interesting astronomy facts precede each talk.

Clean Code I: Arguments from Mike C. on Vimeo.

Another audience-challenging presentation by Bob Martin examines the process of cleaning up Java functions.   This talk starts with a pop quiz - you have three minutes to examine a two-page Java function and figure out what it does.  Examples of great Java functions and poor Java functions will be examined for the audience's review.  Martin will help you learn the process by which an expert coder would approach, analyze, and refractor this code.   You'll discover how large functions should be and how they should be named and documented.  You'll also learn how many indent levels it should include and how it should deal with exceptions, arguments, and return values.

Clean Code III: Functions from Mike C. on Vimeo.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}