He Cloned My App, Then Sued Me for Stealing ItChapter 8

Eighty-Seven Percent Similar to a Textbook

Dr. Gordon Prentiss had a beautiful résumé and a beautiful number, and I hated both of them in a way I found very instructive.

His declaration ran forty-one pages. It described a tool called ParityScan, "an industry-standard source code comparison system used in academic integrity and litigation matters." It explained that ParityScan had compared every source file in the Patungan repository, as it stood in the public snapshot Halcyon's lawyers had downloaded before my account was disabled, against every source file in a copy of Tallybird's repository. It reported that of Patungan's 41,200 lines of Dart, 36,000 lines were "substantially similar" to code in Tallybird.

**87.4 percent.**

It was a headline of a number. Wren put it in her newsletter that evening. A morning-show host in Jakarta read it aloud while a graphic spun behind him. In the comments on my posts, strangers who had never seen either codebase announced, with authority, that *nobody writes 87 percent of an app by accident.*

"Is he lying?" Dinda asked on the phone, mid-shift, whispering from a supply closet.

"No."

"Then I don't understand."

"Neither does anyone who reads the number," I said. "That's the trick. It's not a lie. It's an answer to a question nobody asked."

Mari had sent me Prentiss's appendix at 6 a.m. and said, "I'm going to teach you something I wasn't taught in law school: how to attack a number by taking it apart, not by yelling at it."

"What if the number is right?"

"Then we learn that. Either way we look inside."

That is what I did for the next two days, at the kitchen table, with a pot of kopi and a legal pad.

First, I needed to know how the tool worked, because a number is only as honest as its method. Prentiss's declaration, to his credit, described it clearly. ParityScan, like a family of tools going back twenty years, reads source code, throws away the parts that don't matter to a compiler, and compares what remains. It replaces every variable name with a generic placeholder, strips comments and whitespace, and then slides a window across the stream of tokens. For each window, it computes a hash, a fingerprint. A clever selection rule keeps only a sparse subset of fingerprints, enough that any long shared passage will be caught, but few enough that the comparison is quick. This is the idea behind a well-known technique called *winnowing*, published by three computer scientists in 2003.

This design has a purpose. It is meant to defeat cheating students. If somebody copies an assignment and changes every variable name, the normalized token stream stays the same, and the scan still catches it.

It is also, as a consequence, a machine for finding sameness, any sameness, including sameness that has nothing to do with theft.

"Where does the sameness come from?" I asked the empty kitchen. "Where would you expect it?"

I opened Prentiss's list of matched files. Ten minutes of sorting later, I saw the first pattern, and it was almost funny.

Eighteen thousand seven hundred lines of Patungan's source were *generated.* That is a normal feature of modern projects. A tool reads a short description and writes thousands of lines of mechanical code: translation tables for six languages, serialization helpers, state classes. Nobody types these. Every Flutter project that uses the same tools produces nearly the same output, shaped by the same templates. ParityScan had matched seventeen thousand nine hundred lines of this generated material.

I wrote *17,900 generated* on the legal pad.

The second pattern: boilerplate. Every Flutter app starts as a template: a platform runner for Android, one for iOS, a main file, a theme file, a build configuration. A new project from the standard command contains thousands of lines that every Flutter developer in the world shares. ParityScan had matched three thousand eight hundred of them.

*3,800 template.*

Third: settle_core. My own library, MIT-licensed, which sits in both trees. A thousand one hundred and fifty lines. Of course they matched, because the code was one copy.

*1,150 settle_core.*

Then the one I had not expected to be large. Lines that are trivially alike because the language compels them to be. `import 'package:flutter/material.dart';` Closing braces. `@override`. `const SizedBox(height: 16)`. `super.key`. The constructor of a stateless widget, which in Flutter looks the same in everyone's code, written the same way, because the framework demands it. Nine thousand nine hundred and fifty lines.

*9,950 idiom.*

I added the column and checked it twice, then a third time.

17,900 + 3,800 + 1,150 + 9,950 = 32,800.

Prentiss's matched total was 36,000.

Thirty-six thousand minus thirty-two thousand eight hundred is three thousand two hundred.

I put the pen down.

*3,200 lines.*

I had taken an 87.4 apart, and what was left at the bottom was a figure: 3,200 of 41,200. That is 7.8 percent.

It was a lot smaller. It was also not zero.

Before I let myself feel anything about the 7.8, I did what Mari had told me to do first: I tested the instrument. A measurement means nothing until you know what it reads on things you know the answer to.

There is a free open-source tool built on the same winnowing method. It was not ParityScan, and I said so plainly in everything I wrote, but it used the same logic, with similar settings to the ones Prentiss described. I downloaded two public Flutter apps on GitHub that I knew had nothing to do with each other: a weather forecaster by a developer in Poland and a to-do list by a developer in Brazil. Different authors, different countries, different features, different years.

I ran the tool on the pair.

**61 percent.**

Sixty-one percent. Two strangers who never met, writing two programs that do not remotely resemble each other, and the instrument said that more than half of one was "substantially similar" to the other. It is what happens when you measure with the wrong ruler. A fingerprint test that counts every swirl, including the ones everybody has, will match every hand to every other hand.

At 3 p.m. Mari put a woman on the call with us.

"This is Dr. Anita Subrata," she said. "She works on code-clone detection and software similarity. I'd like you to show her your method before you show it to anyone else."

Dr. Subrata wore a blue headscarf and an expression of unhurried patience. She looked about fifty. She said, "I'm in Jakarta, so for once you may speak to me in your own language if you like," and I said, "English is fine, thank you," and she said, "It will be good for your English," and I laughed for the first time that day.

I walked her through the legal pad. She nodded at each line, and at the generated-code column she said, "Yes. Standard practice is to exclude that before any comparison. Prentiss did not."

"Is that an error?"

"It's a choice. In a classroom, where students are given a skeleton file, it's reasonable to include it, because everyone starts with the same skeleton and you're measuring what they added. In a lawsuit about *original expression*, it's irrelevant. A copyright claim only concerns the parts a human being chose."

"There's a legal word for that," I said. "Mari told me. Filtration."

"Abstraction, filtration, comparison," said Mari. "It comes from a case from 1992, *Computer Associates versus Altai*, in the Second Circuit. Courts use it to compare software. First, you break each program into levels of abstraction. Then you filter out the parts that aren't protectable: ideas, elements dictated by efficiency or by the platform, public domain material, anything standard in the field. Whatever remains is the candidate expression. Only then do you compare."

"So I just did it."

"You just did it," said Mari, "with a legal pad."

Dr. Subrata raised a finger. "One more thing, Raka. You must report your residual honestly. The number you are going to publish is 7.8 percent, not zero. If you imply the remainder is nothing, you will lose all the credibility you just earned."

"I know. That's exactly what I was afraid of."

"Then say it first."

I opened Prentiss's declaration again, the long appendix, and went down to footnote 14, the one I had read yesterday and not understood until I had done the arithmetic.

Footnote 14. In smaller type than the rest.

*"ParityScan reports the degree of textual and structural similarity between two bodies of source code. It does not determine the direction of copying, whether similarity results from independent creation, or whether any similarity is attributable to unprotectable elements."*

I read it three times aloud, once to Dr. Subrata, once to Mari, once to my own reflection in the black screen of the laptop.

"He wrote it himself," I said.

"He's an honest scholar who was hired by a dishonest client," Dr. Subrata said. "It happens more than people think. The footnotes tell the truth."

I published the method at 9 p.m. A four-page document with the table of exclusions, the control test on the two strangers' apps, and every command I had run, so anyone could repeat it. At the top I wrote:

> ParityScan's 87.4% includes 32,800 lines that are generated, template, idiomatic, or shared library code. Filtering these leaves 3,200 lines (7.8%). Two unrelated apps by strangers score 61% with a comparable tool. **A residual of 3,200 lines remains and it needs explaining.** I'm going to look at it myself, because it's mine.

The reaction was calm, almost solemn. Engineers copied the table into their own notes. A professor in Delft ran the control test on three other pairs of unrelated apps and got 58, 64, and 66. A man who maintained a famous static-analysis tool wrote four paragraphs under my thread that began *I wish more experts published their false-positive rate.*

Jett did not answer. Dana filed a one-page letter noting that Mr. Wibisono's "amateur analysis" was "neither a Rule 702 expert opinion nor entitled to weight." Both sentences were true. I was not an expert. But the method on the page did not need me to be.

I kept the legal pad on the table and went through the 3,200.

It took me until two in the morning.

They were not trivial. They were not idiom. They were the places where a human being makes choices that don't have to be made one particular way. The structure of the expense list screen: the order in which five widgets were composed and the odd little rule that hid the *settle up* button until at least two people had balances. The way I rounded corners on cards, radius 14, then 10 on the nested ones. The whole *coin stack* animation: a painter class with a hand-tuned list of weights.

`[0.91, 0.87, 0.93, 0.89]`

I had chosen those numbers myself, on a weekend two Novembers ago, by changing them one at a time and running the app until the coins felt heavy. They came from nowhere. They were not a standard. They were a person's taste, written down.

I opened Tallybird's file, the one matched by ParityScan.

`[0.91, 0.87, 0.93, 0.89]`

In the same order. In a different file, with different variable names, in code that had been carefully, patiently restructured.

I sat there until the rain came.

A tool can lie by overcounting. It cannot invent a number that happens to be the same four decimals I had typed with my own thumbs.

I had broken one big claim into pieces. One piece was real. And the question under it had not moved at all.

If those weights were in both apps, they had traveled in one direction.

Which one?