New Day, New Problems - Part 3

Removing Information


One day I might actually start using notes for inconsequential details instead of continually referring to previous work. Until that day comes, I’ll be ctrl-f’ing my way to sanity. What was I talking about again? I have no idea.


–Beginning Basic Narration of Recording 9–

The recording resumes with Sarela and Lapadj exiting the supply closet and sliding back into place. Anna is still sitting at the terminal. Her head cranes to look at ‘Harrison’ returning to sitting beside her.

“You know, I’m not the type of person to discriminate because of someone’s particular beliefs. People can choose to believe whatever they want,” Anna bumbles out those words.

Lapadj stares at her for approximately eight and a half seconds. Then he blinks. All the while, Sarela is cackling softly in the background, impairing the ability to hear the simple ambient noise. She ceases when Lapadj shifts and then begins to look like he is about to speak.

He does a moment later with: “Okay.”

“Okay,” Anna repeats and nods her head. “So, ugh, back to fixing the code, yeah?”

“Yes. What is next?” He looks over the screen and highlights the next suggestion for their code. “They want us to make it so the ID is generated by the PostgresData using the built in serial feature. So we do not supply the ID.” He made a sigh. “Work wasted.”

“But it’ll be easy to change,” Anna points out vaguely cheerily and clicked open the editor to begin making the changes to their imperfect code.

“It is to be hoped,” Lapadj says.

“Yeah. Seems simple, just remove a parameter here and there, it is already a serial so it auto increments….” A flurry of typing transpires as she modifies their addPost function. “Okay. I think I got it.”

“Perhaps. Now run the tests.”

They do not even run. The editor cries out at them, informing them that more arguments are being passed into the function than is allowed.

“Oh. See! This is where tests are helpful. If we had other code that depended on it we might’ve forgotten to change it too.”

Lapadj grumbles. He takes control of the keyboard and stares at the problematic test case. Without word, he begins to modify it. It takes a short time.

The modified case ends up like this:

@Test
public void testAddPostEntersDataIntoTable() throws Exception {
    PostgresData postgresData = new PostgresData();
    postgresData.addPost("A Title", "Content");
    Statement st = connection.createStatement();
    ResultSet resultSet = st.executeQuery("SELECT * FROM posts");
    assertNotNull(resultSet.next());
}

Then he clicks to run and it passes.

“Nice,” Anna says. “You know we should probably add something so it automatically clears out the table after each test run, so we make sure it is testing a fresh database. So we don’t have to do it manually.”

Anna takes the keyboard and adds the following code:

String deleteQuery = "DELETE FROM posts";
String resetSequenceQuery = "ALTER SEQUENCE posts_id_seq RESTART";
Statement deleteStatement = connection.createStatement();
Statement resetSequenceStatement = connection.createStatement();
deleteStatement.execute(deleteQuery);
resetSequenceStatement.execute(resetSequenceQuery)

“The second command resets the serial sequence counter so it starts back at one,” she explains and then re-runs the tests with this function added to the ending of each test case. Everything appears to work. “Cool.”

“Great,” ‘Harrison’ states lifelessly. “I will commit it.” He performs the operations to commit and push their changes onto the Human network.

“What’s next?” the Human wonders.

Lapadj stares at the screen and reports: “A function to delete a post by ID.”

“That is hilarious. You spend all that time trying to figure out how to store information, and now they want you to delete it. That is actually Empirian.” Sarela laughs. “Do you feel oppressed?”

Lapadj snaps back: “Do you feel oppressed?”

“I feel free,” Sarela says slyly over Anna asking if they want to break for an early lunch. Lapadj affirms and the scene fades away as Sarela flies off.

–Ending Basic Narration of Recording 9–


I’m a failure. To Be Continued.