Casa de Quixote is a small, state-run retirement community in La Mancha, in central Spain. Sergio is the sole developer of software managing hundreds of residents. Missing documentation, he tracks down his predecessors for help.

"Just one left."

Sergio scrolled through several dozen pages of notes, collected over three months on the job at Casa de Quixote. His efforts to track down his predecessors had given him little insight, but he had been able to muddle through the swamp of anti-patterns in the code.

But the last name, Alonso Quixano, still eluded him.

A Madman's Code

"He only lasted a week," Miguel said. "He quit the day before we called you for an interview."

"Well, he wrote thousands of lines," Sergio said. "I think he checked in about 9,000 lines into SVN before he left. And most of them don't work!" Sergio pointed to a line he had commented out, followed by the corrected. "That bug you pointed out three months ago, when bills would be sent a few days after the start of each month sometimes? That's his fault."

    //int startingDay = calInicioFacturacion.set(GregorianCalendar.DATE, 1);
    int startingDay = calInicioFacturacion.getActualMinimum(GregorianCalendar.DATE);
    calInicioFacturacion.set(GregorianCalendar.DATE, diaInicio);

"And here, in the invoicing code, this should have been written as a loop, but instead he wrote this huge monstrosity!"

	// List of bill items
	List<FacturaServicioFacturable> sF =facturaDao.getFacturaServiciosFacturables(r.getFactura().getCodigo());
	if (sF.size()==0){
		writer.print(RemesaBancariaUtil.segundoOpcional(r.getFactura().getDatosFacturacion().getResidenteSocio(),null));
		writer.print("\r\n");
		contador++;  // counter
		writer.print(RemesaBancariaUtil.terceroOpcional(r.getFactura().getDatosFacturacion().getResidenteSocio(),null));
		writer.print("\r\n");
		contador++;
		writer.print(RemesaBancariaUtil.cuartoOpcional(r.getFactura().getDatosFacturacion().getResidenteSocio(),null));
		writer.print("\r\n");
		contador++;
		writer.print(RemesaBancariaUtil.quintoOpcional(r.getFactura().getDatosFacturacion().getResidenteSocio(),null));
		writer.print("\r\n");
		contador++;
	}else if(sF.size()==1){
		writer.print(RemesaBancariaUtil.segundoOpcional(r.getFactura().getDatosFacturacion().getResidenteSocio(),sF.get(0)));
		writer.print("\r\n");
		contador++;
[…]
	}else if(sF.size()==2){
		writer.print(RemesaBancariaUtil.segundoOpcional(r.getFactura().getDatosFacturacion().getResidenteSocio(),sF.get(0)));
		writer.print("\r\n");
		contador++;
[…]
	}else if(sF.size()==3){
[…]
	}else{
[…]
	}

"I've spent weeks hunting down everything he's done wrong," he said. "I want to find him."

"Well, best of luck," Miguel said. "I'll give you the address he left on file."

Phantoms

Sergio drove his Sandero down a long, gravel road, into the plains of La Mancha. The road ended at a farmhouse, at least a century or two old, with peeling white stucco and a crumbling red tile roof.

Sergio re-checked his address. This remote dump was definitely Alonso Quixano's last known address, but Sergio wondered if anyone had been living there for a while.

He got out of the car and inspected the house. Through dusty windows he could see the living room, where a rusting set of plate mail armor stood on a mannequin. In a corner was a portrait of an old woman wearing 18th century dress, a label on the frame reading DULCINEA.

But every wall was covered in paintings of windmills.

Windmills? Of course, Sergio thought, Alonso Quixano! I should have known better!

Just A Windmill

"You think he snapped?" Miguel said. Sergio had just returned to the office and explained what happened. "He was acting very erratically on his last day."

"Psychotic breakdown." Sergio nodded. "I thought Alonso Quixano sounded familiar; I should have remembered it was Don Quixote's name before he changed it."

"Well, so much for getting a few more comments out of our past developers. I hope you got enough documentation to start correcting more bugs."

"Plenty," Sergio said. "But a coder's personality can tell you a lot, too. And this app was written by madmen and fools."

That afternoon, Sergio emailed his resignation to Miguel on his ancient machine. He would leave behind enough documentation for his successor. His detective work had made him a better programmer, but he knew in what path madness lie. He decided to leave while he could still tell giants from windmills.