Panther ODM
Code redesign email
Documentation Exercises Builds

Panther ODM Version 2.0

The following email was recieved from the lead developer...

From: Chloe Beck [Lead Developer]

Sent: Monday, 7 August 2017 17:51 p.m.

To: Mike Talks [Avionic Manager]

Subject: Panther ODM refactoring

Hi Mike

Well yes, the test team came to me over the Panther ODM code, with some concerns about how we test it – I’ve taken a look into it, and share their concerns.

I was impressed that one of them had found this article by Angie Jones on this, and had even found a couple of cute quotes from it.

It’s not the worst code I’ve seen, but it could be a lot better. I really don’t like how Jake has created a large class to handle both fuel calculation and weight management. I did raise concerns with you about his work, and didn’t feel he was the right person to be working on this so unsupervised.

What I’ve done is break down his main class – from outside, AircraftManagement looks and works the same (so all those JUnit tests will work as is), but ideally a class should be a small, self-contained instance. So I’ve added the following smaller classes which AircraftManagement uses,

  • ManageWeight – handles everything to do with the weight of the aircraft including refuelling and applying changes due to fuel being burned
  • CalculateFuelUsage – handles the calculation of fuel usage for the aircraft given a set altitude and weight

Breaking it down like this should make the testing a lot easier – your team might want to add dedicated testing classes as well.

The testers were previously tying themselves in knots because as soon as they got their aircraft to the right height they needed, its weight had changed from the climb. It should be easier to test more scenarios under CalculateFuelUsage, they have better control of the inputs when they unit test now, with the weight being something you can just set as needs be.

This will mean you can test in depth using just the CalculateFuelUsage class, but you’ll have to check separately that the AircraftManagement is handling passing changes in weight from ManageWeight to CalculateFuelUsage and vice versa. It looks to be good – but that’s why we test yeah?

I’m off on client site tomorrow for the rest of the week up in Lossiemouth, Scotland. You know how it is on the airbase, I have to check in my smartphone whilst on site. My trip is important, and I really can’t it, but the test leads seem to be smart and onto it, so I think you’ll be fine!

And cheer up, it could be worse. We could still have Jake working for us! :-)

Chloe Beck

Lead Developer, Panther Project