8 ms·
I primarily do java work (consulting) for enterprise. I've always seen it as a combination of convention and time. There are java applications that have been a
by columbo 14y ago
I primarily do java work (consulting) for enterprise. I've always seen it as a combination of convention and time.
There are java applications that have been around for decades. I've worked in codebases that are over twenty years old. Some of these systems are responsible for billions of dollars and have been heavily tested (the others are responsible for billions of dollars and have been barely tested).
Say you are a consultant, and you're working on a shipping application that has been around since the late 90's and is responsible for moving goods where the sum total of all items in transport over a year is larger than the GDP of Taiwan.
In that application there is a Warehouse interface. Simple thing, basically it has a receive() and distribute() method that moves product from one location to another (warehouse.receive(truck) or warehouse.distribute(200,truck)).
Around 2000 someone needed to create an edge case because specific warehouses are only available during specific times of the year. Like black Friday to Christmas. Usually it is too much overhead to keep all these warehouses running so they are only open 1/2 the year (this doesn't happen, but work with me). So someone created class TimedWarehouse that will do this calculation (on date X no longer receive).
Now it is 2012 and you are just a contractor. The big problem with the TimedWarehouse is at the end of the year you MUST VACATE ALL GOODS (because the warehouse is going to shut down). For the last couple of years product has been lingering in these warehouses keeping them open longer (costing more money).
The best way to handle this is perhaps a batch process job that sends emergency shipments as it gets closer to the end of the year. So something that cleans the timed warehouses out. Now you're just a consultant, you can't rework the entire framework but you must keep with convention... what to do
TimedWarehouseProcessor (nice... but doesn't indicate that it is only used towards the end of the year)
TimedWarehouseYearlyCleanout (makes more sense, but is terribly specific, what about warehouses that are open twice a year)
TimedWarehouseCleanoutManagementUtility (Bingo! More generic sounding, and it is a 'utility')
Imagine the poor sap who might need to extend that class. The process repeats over time. More contractors following the rules of convention, larger and larger class names.
- matwood 14y agoSo true. Using your example: AbstractTimedWarehouseCleanoutManagementUtility TimedWarehouseCleanoutManagementUtilityFactory TimedWarehouseCleanoutManagementUtilityConfiguration TimedWarehouseCleanoutManagementUtilityDto etc...
- eclipticplane 14y agoI feel violent tendencies just reading that!