Understanding exception handling is a key programming skill and one that every seasoned developer should know and understand. Those same rules hold true for real-life exceptions that occur in your team and workplace.

Exceptional handling…

Wikipedia defines exception handling as:

Exception handling is the process of responding to the occurrence, during computation, of exceptions both anomalous or exceptional conditions requiring special processing – often changing the normal flow of program execution.

Communications between people underpin any team and it’s quite common for issues to arise that cause difficulty and upset the team dynamic. These type of exceptions happen frequently and require special attention, often changing the normal flow of your day at work.

The following are some common best practise programming rules for handling exceptions:

  1. Don’t use exceptions as a control flow mechanism
  2. Don’t swallow exceptions – deal with them appropriately
  3. Catch and recover from exceptions only if necessary – if it’s a problem treat it as a problem

The same rules apply

Just as when dealing with code; you can apply the same exception handling rules when dealing with people and teams. In fact, the very best team members I’ve ever worked with apply these rules without even realising.

Don’t use exceptions as a control flow mechanism – rather than resolving issues when they arise, put in place a process to stop issues getting in the way and impacting your work routine.

_Example:_if your colleagues are continually interrupting you to ask the same questions over and over

  • “What is the test site URL?”
  • “I’ve forgotten the password for the staging environment. Can you tell me?”

Don’t politely keep answering them each time. This adds overhead and effort in a manner you aren’t in control of. Remember, exception handling is expensive. Instead put in place a way of stopping these distractions, perhaps by investing time to build a team knowledge base in a wiki.

This time invested upfront will allow your colleagues to self-serve, meaning you can work in a more controlled way without fear of distractions.

Don’t swallow exceptions – if you find a problem don’t ignore it. Deal with it! Unresolved problems that are left to fester will only result in more lost time later down the line. Exactly like the most nasty software bugs caused by swallowed exceptions that take an age to pinpoint and resolve.

These blockers might be anything from a poor quality release process to problems between individual team members. The important point is to not ignore them and accept the status quo. Its much better to solve them or help the team to solve them as soon as you possibly can. That way you can get on with the real work of delivering awesome code.

Catch and recover from exceptions only if necessary – when exceptions do happen then the best people approach them in a positive way. Most times it’s best to ‘throw’ the exception and seek help to work out a resolution, perhaps from your manager, scrum master or team. Other times it might be best to handle the exception yourself, log the problem and suggest ideas of possible ways to move forward.

_Example: Rather than just saying that a story isn’t good enough. Take a proactive role in working out what wasn’t right and helping the team learn to ensure stories don’t get rejected for similar reasons next time. In fact in this case, you might consider building in some backlog grooming sessions to ensure that problem stories are improved first, meaning they never reach planning sessions in an unacceptable state and you never have to recover.

Developing is more than just you and your code

The logical skills and coding best practise that you learn through programming can often be applied similarly to real-life situations. Although people behave less predictably than machines, they still respond to logical patterns and rules.

Next time something exceptional happens in your team, see if you can apply your programming knowledge and help to refactor any problem to success.

This post was first published on LinkedIn Pulse on 11th April 2016 Exception handling for developers – dealing with day-to-day issues in the workplace