Casa de Quixote is a small, state-run retirement community in La Mancha, in central Spain. Sergio begins his new job as the sole developer of software managing hundreds of residents.

"Here is your office," said Miguel, the community manager of Casa de Quixote. He showed Sergio inside. The office was as barren as a prison cell: there was nothing in the room save a desk, a computer, and a wooden chair.

Sergio booted the ancient computer. Eclipse started at launch, opening a Java project: the community management application. Sergio scrolled through a few class definitions. He gasped. "Where's the documentation?"

Miguel squinted to read Sergio's screen. His eyes were yellow, as sallow as his complexion. "All of our prior developers assured us there was ample documentation in their exit interviews. Aren't there comments?"

"Very few," Sergio said. "No JavaDoc comments, not even a README file."

"I'm sorry you can't start under better circumstances," Miguel said. "Unfortunately, we have a problem that needs to be addressed right away."

Mirrors and Mirrors

The problem, Miguel explained, was an ever-increasing application load time. Casa de Quixote couldn't afford new equipment, which required frequent restarts, but the manager application took longer to load each time.

Guessing some naive optimizations would help, Sergio turned to the Eclipse project. He immediately wondered just who wrote had written the bulk of the application code. As far as he could tell, there were three, very different programming patterns in use.

The most prominent pattern was an over-reliance on struts. The developer or team that wrote the most code for the application used something called GenericDao (Sergio hadn't heard of it) to generate all of their classes. Each one inherited from EntidadInterface:

    public interface EntidadInterface {
       public String print();  // toString() is SO dÈmodÈ
       public Long getCodigo();  // getCode
       public void setCodigo(Long codigo); // setCode(Long code)
       public Long getUsuarioC();  // getCreationUser

Instead of calling methods directly, the code would use reflection to get a reference to the method, call it in a try/catch block, and log it if anything went wrong:

public abstract class GenericAdmAccion<T extends EntidadInterface> {
     * This method gets the code of the entity, assuming its accesor is called getCodigo
     * @param entidad
     * @return
    protected Object getCodigo(T entidad) {
        try {
            Method m = entidad.getClass().getDeclaredMethod("getCodigo");
            return m.invoke(entidad, null);
        } catch (Exception e) {
            log.error("Error getting method getCodigo for class " + entidad.getClass());
            return null;

Of course the application is too slow! Sergio realized. If every action that would normally be a method call uses reflection, all that introspection has to be bogging everything down!

Sergio found some commonly-used methods in some Singleton objects, then found/replaced the reflection-bound invokations with direct method calls. Rebooting the application now only took seconds instead of tens of minutes.

But something bothered Sergio. Who wrote GenericDao? Why was this developer so determined to work around Java's static types? And why wasn't there any kind of documentation?

Storming the Skyscraper

"The first developer?" Miguel said. "Oh, yes! It was a big firm in Madrid, about ten years ago. The government gave us enough money to hire some professionals to write an application to help with all that paperwork."

"Can you give me the name of the firm? In fact … could I get the entire list? It'll help if I can get any kind of insight. Without any documentation at all, it's like I'm wandering in a fog."

"Just the Madrid firm and two others," Miguel said, "not including you."

That weekend, Sergio stood in Cuatro Torres in Madrid, staring up at forty-story office building. On its side read GENERICDAO INTERNATIONAL. Sergio had done his research. The firm, a major Java developer, had branches across Europe, with the largest in Madrid.

One of the hundreds of developers in that building wrote the application's code, and Sergio was determined to find out. He charged in.

Five minutes later, three black-suited security guards tossed Sergio out of the lobby, after the receptionist refused to let him upstairs to track down the original team. Sergio sighed, brushed off his clothes, and looked for a place to eat. There were two more developers on the list, both hired in-house after GenericDao; even if he couldn't get help from the giant firm, surely he could get some fellow freelancers to pitch in for a little documentation?

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!