Pdf Processor
Postmortem: I Shipped Five Algorithm Ports and the User Saw Nothing
TLDR
Porting five complex backend algorithm families (line clustering, bimodal word gaps, OCR gates) produced zero perceived user value because two high-visibility document features, stacked math display formulas and typographic text alignment (centered footers, justified body), remained broken. Prioritizing extraction features by visual impact rather than reference library availability prevents wasted engineering cycles.| Heuristic Port Category | Engineering Work Executed | User Perceived Impact | Priority Alignment |
|---|---|---|---|
| Backend Line/Word Clustering | 5 Algorithm Families Ported | Zero ("No visible difference") | Misaligned |
| Visual Math & Alignment | Stacked fractions & container frames | High ("Document extracts correctly") | Correctly Aligned |
Retrospective lessons & process changes
- Prioritize by Visible Delta: Evaluate target documents visually before porting algorithm libraries, building high-visibility features first.
- Audit Native Code Context: Inspect existing adjacent functions (e.g.
_inferAlignment) for scope deficiencies before implementing new modules. - Dump Geometry Before Coding: Print raw coordinate data for complex layout features (
console.logbounds) to verify mathematical assumptions on paper first.
// Container Frame Union Alignment Analysis
export function calculateBlockAlignment(blockItems, columnContainerFrame) {
const frameWidth = columnContainerFrame.xMax - columnContainerFrame.xMin;
const blockLeftMargin = blockItems[0].vx - columnContainerFrame.xMin;
const blockRightMargin = columnContainerFrame.xMax - (blockItems[0].vx + blockItems[0].vWidth);
// Equal margins within 8px tolerance indicate centered text if (Math.abs(blockLeftMargin - blockRightMargin) < 8) { return 'center'; } return blockLeftMargin > frameWidth * 0.3 ? 'right' : 'left'; }
Rule of thumb: Prioritize algorithm ports by user-visible document layout changes rather than reference library availability.
Read this post in the full Engineering Journal →