• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Developing new skills: Better Error handling, Better Debugging

 
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the interest of becoming a better programmer, I'm looking for pointers to books, articles, resources related to error handling and debugging.

1) Error Handling
coding "defensively", best practices with respect to throwing/catching exceptions, handling nulls (and coding so you don't have to), working systematically to cover edge cases, different error handling strategies or approaches, and the contexts in which they make sense

2) Debugging
different types of debugging for different situations, how to step through code effectively, various debugging tools (more like categories of tools than the actual implementations, though implementations would also be helpful -- maybe comparing and contrasting different tools and techniques for different situations)

For the most part I work 'test driven' as best as I can. I'm working in legacy code a lot of the time, very little of the code is covered in tests (we've increased coverage from 18% to 35% in the past 3 months) and that code passes nulls around like candy on Halloween.

If you have any suggestions of where to start, I would be very grateful!
 
Ranch Hand
Posts: 430
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.javaworld.com/jw-08-2000/jw-0818-exceptions.html?page=3
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For legacy code, instead of learning better debugging, I'd suggest to read the book "Working Effectively With Legacy Code" - which basically is about how to get such code under test.

Another important skill to learn in such a situation (as well as in general, actually), is acceptance testing. Take a look at FitNesse, for example.
 
Author
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ilja Preuss wrote:For legacy code, instead of learning better debugging, I'd suggest to read the book "Working Effectively With Legacy Code" - which basically is about how to get such code under test.



I was going to recommend exactly the same thing. Excellent book and a great way to think about legacy systems (which almost all systems are).
 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestions!

How to Work with Legacy Code is one of my favorites, and my team and I are slowly rewriting the code base.

Every time I need to touch code I try to add characterization tests and break dependencies (where I can), refactor once it's under test, and make room to hook in the new feature. If possible, I write the new feature in a completely separate place, and just hook it into the old legacy stuff.

I work on a team of great, passionate, skillful people with a very eclectic background. We write legacy code every day. Not as much as we used to, but still a fair amount, even though we are striving to do better (I got a continuous integration server running! That's a start).

Still, I want to figure out how to debug and troubleshoot more efficiently. Unit tests are fantastic and I spend a lot less time debugging than I used to - but when I do need to debug something, I feel the need to do sore more effectively.

reply
    Bookmark Topic Watch Topic
  • New Topic