Mitch Pronschinske is the Lead Research Analyst at DZone. Researching and compiling content for DZone's research guides is his primary job. He likes to make his own ringtones, watches cartoons/anime, enjoys card and board games, and plays the accordion. Mitch is a DZone Zone Leader and has posted 2576 posts at DZone. You can read more from them at their website. View Full User Profile

How to Clean Your Java Functions and Arguments

  • submit to reddit
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.


Craig Doremus replied on Tue, 2010/08/31 - 9:14pm

These are excellent presentations as are others I've seen Bob Martin give. But the slides where he shows source code is very hard to see due to poor contrast on the video. Do you know if these slides/code are available for download?

Jerry Zhang replied on Wed, 2010/09/01 - 12:08am

Couldn't see code at all

Jerry Zhang replied on Wed, 2010/09/01 - 12:09am

The worse thing is when I submit this comment it refresh the page itself so I have to start the slide again. Where is the AJAX.

Eran Harel replied on Sat, 2010/09/11 - 7:43am

The slides are clearer on HD

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.