Structure and the FBI
Join the DZone community and get the full member experience.Join For Free
a hypothetical question.
let's say you're an fbi agent.
one day, you find yourself at the lincoln center in manhattan, new york, and desperately need to get to the rockefeller center on foot. you happen to know, however, that you are being followed by a foreign spy. let's say his name is, oh, dmitri evgenii gurkovsky ("the australian"). what path do you take? examine figure 1 for a moment to make your decision; lincoln center lies at the top and the rockefeller center at the bottom.
figure 1: your path awaits you.
figure 2 shows one possibility.
figure 2: wrong!
if your chosen path resembles that shown in figure 2 then dmitri will probably have you strapped to a chair before nightfall, serving you delicious fruity cocktails of benzodiazepine and sodium thiopental. you have chosen the wrong path (both in actuality and career).
for once, counter-intelligence trade-craft seems to match its depiction in the movies. the police, self-defence instructors, security specialists, news reporters, vacationing celebrities: all will tell you, if you want to, "shake a tail," do not take the direct or obvious path to your destination. always leave your stalker guessing. take an elaborate, circuitous route.
hence figure 3 shows a better choice.
figure 3: a better way to the rock.
in figure 3, you exit lincoln centre and make straight for the department store across the road. then you head into central park. of course you do: everyone evades stalkers in central park; it's practically what central park is for. leaving central park, you drift eastwards, taking 57th street as far as 5th avenue so you can dawdle to browse shop windows as you surreptitiously check for dmitri behind you. only when the coast is clear do you swing onto 6th avenue to finally arrive at rockefeller.
if, instead, you wanted to get to the corner of west 49th street and 9th avenue, you might leave lincoln center and head into central park, but once there you might immediately double-back on yourself to test dmitri's training. (experts will tell you that doubling-back on yourself is potentially confrontational, but nevertheless it remains one of the most favoured and most effective ways of evading a pursuer.) once you had back-tracked a sufficient distance, you might take columbus avenue as far as west 54 street but here veer east all the way to 8th avenue before finally turning onto west 49th street. figure 4 shows your route.
figure 4: another snaking path.
even if you your destination were relatively close-by - in fact, especially so - you would still take wildly evasive maneuvers along the way. if you were going to san juan hill, just a few blocks away, you might (again) pop into central park first, exit all the way past 7th avenue, double-back into central park (again!) and exit near broadway before closing in on san juan hill. see figure 5.
figure 5: san juan hill.the tremendously good news for you and your fbi colleagues is that this tiny section of new york offers thousands of ways of getting from the vicinity of lincoln center to manhattan's many espionage-friendly locations. not even dmitri, with the unlimited resources of his nefarious international operation, could hope to surveil all these routes, all the time. see figure 6.
figure 6: good luck tracing all these paths.
but the tremendously bad news for software programmers is that they are dmitri.
not in spirit, of course, but they are dmitri in that they need to keep track of every one of those paths in figure 6. for those paths in figure 6 are not, in fact, clandestine routes through new york but the transitive dependencies of methods within a single java program. see figure 7.
figure 7: package responders.run in fitnesse.
worse still, figure 7 shows just those transitive dependencies within a single package of a program. figure 8 shows the connections of the entire program.
figure 8: "all the dependencies."
and just as dmitri would like to know the paths that the fbi take in going from a to b, so programmers need to know how methods relate to those on which they depend, however distantly, because only by understanding such connections can a programmer predict the cost of an update, in which a change to any method may ripple back to affect one or more dependent methods. indeed, being able to predict such costs offers the very hallmark of a, "well-structured," program.
nevertheless, an fbi agent might look at figure 7 and wonder whose side the programmer was on. that agent might wonder why programmers create such deep program structures, so apparently designed to foil attempts at tracing transitive dependencies.
we need to create programs of such structural simplicity that would appall those vast fbi departments dedicated to finding ever more convoluted ways to cross populous urban areas.
and we need to start now.
sometimes the map is the territory.
photo credit attribution.
new york map courtesy of openstreetmap .
Opinions expressed by DZone contributors are their own.