Let’s just say a few words for those lost souls you find in codebases when you’re trying to find the survivors.
- Orphans – variables that get initialised but never used
- Else-overload – else blocks after the body of if did a return
- Over-throwing – Exceptions that are declared for throwing but never thrown
- Gulped – Exceptions that are caught, swallowed and replaced with a null return – when the calling method thought it had to catch them
- GDP disaster – where you import things you never use
- Fringe calculations – a calculation a method does ALWAYS when nothing uses the outcome… or where the outcome is a test helper. For example – converting something to String just in case.
- Windbag calls – where something is given its long-form name where a short form is more conventional. E.g. not static importing the most common helpers for tests.
- Wittering – comments that state the bleeding obvious
- Well – duh! – test assertion messages that repeat what a decent test assertion library could auto-generate
- Indeed anything else your IDE marks as unused
All of the above slow down any attempt to interpret or evolve your code.
Pray for them and all who wade through them.