<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jimmie Stanley on Medium]]></title>
        <description><![CDATA[Stories by Jimmie Stanley on Medium]]></description>
        <link>https://medium.com/@jimmiestanley?source=rss-31b80f112b5e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yHJzHL6FYrUmSn0hYZJiFg.png</url>
            <title>Stories by Jimmie Stanley on Medium</title>
            <link>https://medium.com/@jimmiestanley?source=rss-31b80f112b5e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 12:19:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jimmiestanley/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Tried to Build a Weekend Embroidery Tool. It Turned Into a Second Job.]]></title>
            <link>https://medium.com/@jimmiestanley/i-tried-to-build-a-weekend-embroidery-tool-it-turned-into-a-second-job-d1dc49255033?source=rss-31b80f112b5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1dc49255033</guid>
            <category><![CDATA[embroidery]]></category>
            <category><![CDATA[sewing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[embroidery-digitizing]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Jimmie Stanley]]></dc:creator>
            <pubDate>Fri, 12 Jun 2026 20:25:12 GMT</pubDate>
            <atom:updated>2026-09-03T18:36:57.752Z</atom:updated>
            <content:encoded><![CDATA[<h4>A devlog about turning a PNG into thread, and finding out the file format was the easy part.</h4><p>I did not set out to build an embroidery digitizing platform.</p><p>I wanted to make a jacket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BGNSuh9xplbhNCgGgTRjNQ.png" /></figure><p>More specifically, I wanted to put my cat on a jacket, because apparently that is the kind of person I am now. I had an image, some enthusiasm, and the dangerously naive software-engineer assumption that this was probably just a file conversion problem.</p><p>Take a PNG. Turn it into a DST file. Send it to the embroidery machine.</p><p>Easy.</p><p>A weekend project, maybe.</p><p>That was December 2025. It is now June 2026, and that weekend project has become DADE: a browser-based embroidery digitizing app with a Python stitch engine, a React editor, guest projects, cloud projects, export formats, storage infrastructure, public docs, legal pages, a redesigned landing page, and a monthly bill.</p><p>As is tradition in software development, I wildly underestimated the scope of the problem.</p><h3>Embroidery machines do not understand your image</h3><p>The first thing I had to learn was that embroidery digitizing is not image conversion. It is closer to design, the kind you would do with vector paths. You are not turning a picture into another picture. You are deciding where thread goes.</p><p>An embroidery machine does not look at a PNG and think, “Ah yes, that is a cat. I will now sew the cat.” A PNG does not look like a cat to it. A PNG does not look like anything to it.</p><p>It helps to stop picturing a printer and start picturing a CNC mill or a 3D printer. Those do not take an image. They take a toolpath: a list of movements, the G-code equivalent of go here, do this, then go there. An embroidery machine runs the same kind of file. Needle down. Move here. Stitch there. Trim. Change thread. Continue.</p><p>So a DST file, one of the common machine formats, is not “an image file for embroidery.” It is a set of instructions for a robot with a needle. That distinction matters, because a nice-looking image can still be a terrible embroidery design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*Q5e0yHwDEVVoQ3CzqVZfSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*kW3ke5W49JlFnaaGpw1Cqg.jpeg" /><figcaption>Satin fill: the on-screen preview (left) and how it actually sews (right)... My bobbin tension needs work :)</figcaption></figure><p>That was the first trap. I thought I was building “PNG to DST,” a converter. What I was actually building was the design step in between: a pipeline that decides geometry, color, stitch direction, fill behavior, outlines, underlay, and export, then turns a flat image into a toolpath a machine can run. That is not a conversion. It is a different problem.</p><h3>The first version was not a product</h3><p>DADE started on December 18, 2025, though it did not start as a project. It started as a search.</p><p>I was not trying to build a tool. I wanted to finish the jacket. If a PNG-to-DST converter had existed, I would have happily used it and moved on. So I went looking for one.</p><p>But there was nothing to find. Search “PNG to DST” and you mostly get two things: bait-and-switch pages that echo back whatever you typed, or vector-based digitizers like <a href="https://emberdesign.net/">Ember</a> that solve a different problem. Even Wilcom, the closest thing the industry has to a standard, doesn’t really offer this. <a href="https://developer.wilcom.com/plans">And if it did</a>, it would sit behind the kind of license that puts it well out of hobbyist range.</p><p>What I did find were Python libraries that convert between embroidery formats, and they work. That gave me confidence. It also gave me tunnel vision. I read the format problem as solved and stopped looking at the graveyard right next to it: a trail of half-finished machine-embroidery projects on GitHub, abandoned by people who had clearly gotten this far and then walked away. I took that as proof the heavy lifting was done, and I started building one myself.</p><p><em>That was supposed to be the hard part.</em></p><p>And it was. The engine became a technical rabbit hole that ate the rest of December.</p><p>The first commits were exactly as dignified as you would expect from a personal project that had escaped containment.</p><p>There were commit messages like:</p><ul><li>start</li><li>almost</li><li>i wanna cry</li><li>YES!!!</li><li>DADE FILL COMPLETE!!!</li></ul><p>That is probably a more accurate development log than anything I could have written afterward.</p><p>The first few days were about the engine: loading images, detecting stitchable regions, generating paths, assembling stitches, and exporting DST. I was fighting with convex shapes, holes, donut regions, fill behavior, fabric deformation (even with stabilizer), and stitch ordering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8n0UrlrALZHmpZTgvOUxvA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EG_dIDf3Q1-9PzcBZxffhA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zzet4OkXJ52niFa2MecSmQ.jpeg" /><figcaption>Wrestling with circles: fabric pulling causing ovals (left), solving holes and donuts (middle), an almost perfect circle (right).</figcaption></figure><p>The first big breakthrough was getting a <em>generic</em> fill system working well enough to build on. It was not perfect. It was not professional-digitizer perfect. But it was real enough that I could look at the output and think, “Okay, there is something here.”</p><p>That was a dangerous moment.</p><p>Once a project starts working a little, it gets very hard to stop.</p><h3>Then the engine needed a UI</h3><p>At first, I was thinking like a backend/systems person.</p><p>Give me an input. Produce an output. Validate the file. Move on.</p><p>Embroidery digitizing does not work that way. The generated output has to land close to what an artist would have chosen, or the user has to be able to fix it fast enough that it feels like their own decision. Ideally both. That means showing what the tool thinks it is doing — which region became which stitch type, and where to grab when your gut says it is wrong.</p><p>And “the user” here is not a professional digitizer. Professionals already have tools and opinions. DADE is for people like me: too lazy to learn Inkscape, apparently not too lazy to spend six months building a tool to avoid it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_zImB7By7z-dcOgL2ABbbA.png" /><figcaption>First draft of the editor: the stitch plan on the canvas, every fill control exposed in the inspector on the right.</figcaption></figure><p>So DADE started turning outward. The repo picked up guest mode, drag and drop, preview fixes, CORS bugs, and all the unglamorous glue that turns an engine into an application.</p><p>Now I had to care about privacy, onboarding, and whether a new user could tell what went wrong and how to fix it. That meant building enough UI that the engine’s decisions were visible instead of mysterious.</p><p>And it meant I had accidentally started building a web app.</p><p><em>The code, it turned out, was the easy part.</em></p><h3>DST was not the whole story</h3><p>The point of all that UI was to take load off the user: show the decisions, make them fixable. The export file has the same job on the machine side. The more the file carries for you — thread cuts, color changes — the less you have to know. That is where DST started to crack.</p><p>I had picked DST because it is open source and my Topaz 40 reads it. But the biggest limitation I ran into was trim handling.</p><p>DST does not have a native trim command. Trims are usually inferred from specific jump or movement sequences, and different embroidery machines interpret those sequences differently. A file that trims correctly on one machine might behave differently on another, depending on the firmware.</p><p>“It works on my machine” ain’t good enough for a public-facing tool.</p><p>If someone uploads a design, previews it in the browser, and exports a DST file, there is no guarantee that their machine will interpret thread cuts the same way.</p><p>As I dug in, I learned that most machine brands have their own formats — Brother has PES, Janome has JEF — and those formats can say what they mean: cut the thread here, switch to red now. The machine does not have to guess. Supporting those formats meant files could behave predictably on real hardware, not that the export menu got longer.</p><p>So DADE could not just throw a DST file over the wall and pretend the job was done. It needed previews, metadata, thread guidance, machine presets, and eventually a more serious export system.</p><p>As a fun side effect, because I only own a Topaz 40, testing support for other machine formats has often involved sending files into the wild and relying on generous Reddit strangers to tell me whether they actually worked.</p><p>Every time I thought I had found the hard part, the next layer appeared underneath it.</p><p>Generating stitches is hard.</p><p>Making those stitches understandable is also hard.</p><p>Exporting them in a way that matches real machine workflows is also hard.</p><p>Explaining the limitations without scaring users away is also hard.</p><h3>January was when DADE became an editor</h3><p>By January, the project had moved beyond “make output happen.”</p><p>The question became: can the output be improved, controlled, reordered, inspected, and trusted?</p><p>That month was full of work on satin borders, border logic, underlay, assembly ordering, defaults, machine dedupe, smooth rails, zigzag logic, interpolation, vectorization, and the geometry needed to make stitch generation more than a crude fill.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*kJCCseERshiibQsPvI4wYA.jpeg" /><figcaption>A grid of fill algorithms with different parameters — tests like this are how I found workable defaults.</figcaption></figure><p>The real motivation was fills. I did not want DADE to plaster thread across a region and call it done. Traditional embroidery has named fills — tatami, satin, puff — and each one has its own geometry, its own rules, and its own knobs. I wanted those.</p><p>Experimenting with them is what forced the architecture to grow up. I made the stitch generators schema-driven: each generator describes what controls it supports, and the editor builds its panel from that description. In plain English: when I invented a new fill, the UI came along for free. Nobody sees that feature in a landing-page screenshot, but it is what kept experiments cheap.</p><p>It also changed what DADE was.</p><p>A converter says, “Upload file, receive file.”</p><p>An editor says, “Here is what the system thinks. Here are the controls. Change the decision.”</p><p>DADE needed to be the second thing.</p><p>For the record: tatami turned out beautifully. Satin and I are still negotiating. <em>(Update: satin and I reached terms. It took until August and a lot of test fabric.)</em></p><h3>The months nobody blogs about</h3><p>I have a 9-to-5. DADE started just before Christmas break and consumed it completely, and for a while the progress came in leaps, which kept me going on weekends after the holidays ended. Then the leaps stopped. February and the spring were incremental: testing, fixing, retesting, and a question I kept circling — if Wilcom doesn’t do this, what business do I have trying? The counter-argument was always the same: I’m one or two features from version 1.</p><p>I am still one or two features from version 1. I have been one or two features from version 1 since February.</p><p>This is why nobody blogs about these months.</p><p><em>Update, September 2026</em>: version 1 shipped on August 20. It took another two months from here.</p><h3>The part I kept avoiding: persistence</h3><p>For a while, guest mode was enough.</p><p>I liked guest mode. I still do. Upload an image, experiment, see if the app is useful, decide whether it is worth going further — no account demanded. But the honest version is that guest mode was also a shield. I did not feel right taking anyone’s money for what the app was yet, and charging means support, and support means me. I am one man with a day job and a family.</p><p>Projects that live only in the browser also only get you so far technically. The features that would justify a paid tier — brand-specific formats, cloud projects, merging islands (which, annoyingly, requires persistent storage) — all need real infrastructure. It costs money just to prototype them.</p><p>Eventually, if DADE was going to be more than a toy, people needed durable projects. They needed to come back later. They needed project metadata, geometry snapshots, stored assets, account flows, and some confidence that their work would not disappear when a tab closed.</p><p>March was when DADE crossed that line. Up to then I had been cheap about databases, because operating a test and production database cost twice as much as just one. That was fine when nobody used the app. But people kept finding it, and every so often I would be mid-schema-change and realize there were real users on the site with real projects. So March went to splitting the two apart, migrating the production database, and adding everything persistent storage needed: S3 asset columns, project metadata, versioned geometry snapshots, token refresh handling. None of it visible to users. All of it the price of taking them seriously.</p><p>The architecture settled into two modes:</p><p>Guest mode for lightweight use, stored only in your browser.</p><p>Cloud mode for signed-in users who need durable projects, saved assets, project metadata, and versioned geometry snapshots.</p><p>Once people could save work, losing it became my fault. Cue the second job I forgot I applied for.</p><h3>A stranger walked through my landing page</h3><p>By June, I had a working app, but working is not the same thing as trustworthy.</p><p>Software can fail technically. It can also fail by feeling too sketchy to trust with your time.</p><p>That matters even more for a creative tool.</p><p>If someone uploads artwork, waits for processing, studies a preview, exports a file, and walks over to an embroidery machine, they are taking a small risk. Maybe the output is wrong. Maybe the design is ugly. Maybe they waste stabilizer, thread, fabric, and time.</p><p>What forced the issue was a beginner embroiderer on Reddit (thank you, u/HuntWorldly5532) who walked through my landing page top to bottom and narrated everywhere it lost them. The domain — png2dst.com at the time — set off alarm bells before the page even loaded, because numbers in a domain read as sketchy. The comparison table promised “no learning curve,” which was a promise the app could not keep. The workshop section read like a list of things that did not work yet. None of it was mean. All of it was true.</p><p>I had been treating the landing page like a blog. It is not a blog. It is the front door. I bought a new domain, restructured the site, and redesigned the page around one question: what does a stranger actually get if they use this today?</p><p>Most of what mattered in the redesign was not visual. It was the copy: what the page promised, what it admitted, and who it thought it was talking to. The pixels came along too — design tokens, fonts, editor styling, accessibility, the public pages — but those were details. The point was that the landing page and the user journey finally got the same attention I had been giving the engine.</p><p>As a backend-leaning developer, this did not come naturally to me. I am more comfortable with systems that talk to other systems than systems that have to talk to people.</p><h3>The hard parts weren’t the ones I could code</h3><p>By this point I had spent months on geometry, storage, and export formats. None of it was the thing that humbled me. I am a software engineer; designing systems and writing code is the part I know how to do. The hard part was everything else: web hosting, DNS records, OAuth (log in) support for Google and Facebook, search engine results for Google and Bing, and the discovery that user experience is a discipline people train for, not a coat of paint.</p><p><em>And then, under all of that, the actual hard part: people.</em></p><p>Start with input quality. Any software like DADE will be brutally sensitive to it. A clean, color-reduced image with sharp edges and real transparency stitches well. A screenshot someone dragged off Google does not. I knew this cold, which turned out to be a real problem. I built the tool, so I feed it good images without thinking. I reduce colors, sharpen, and add transparency out of pure habit, using a workflow I had already memorized. I was the worst possible person to test my own app, because I had quietly trained myself around every sharp edge in it.</p><p>And there is no graceful way to tell a user “garbage in, garbage out.” The whole promise of a friendly app is that you upload a thing and get a result. The truth is that the upload is half the work, and most of the bad output traces straight back to the input. Saying that out loud, on a welcome screen, feels like blaming the customer for showing up. I still have not fully solved it. It might be the hardest design problem in the whole project, and not one line of it is about stitches or fill algorithms.</p><p>The messaging walked back as this sank in. The landing page started at “PNG to DST in 30 seconds.” Then “PNG to Embroidery in minutes.” Then I quietly deleted most of the boasting, because every confident promise was just a setup for someone to feel lied to. The boasting went deep enough that it was in the domain name.</p><p>I did not work any of this out alone. Knowing what I am not good at is a skill I actually have, so I paid for the ones I am missing. Sixty dollars bought me an hour with a designer and a completely different idea of what a landing page is even for. I hired a tester because I had gone blind to my own product, then had to hire a second one after the first quietly used AI to fake the human testing I was paying for. Paying a stranger to tell you your baby is ugly is not a natural instinct. It was also the best money I spent on this ‘weekend’ project.</p><h3>What DADE is now</h3><p>DADE is my attempt to make embroidery digitizing more approachable for non-embroiderers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6E10a2LOjI-SfKxLSAdqTw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rxqpIwvB_6F-BdpZE9B3xw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZpMjy6NEbkiEM8v1tJDVhw.png" /><figcaption>A few things actually made with DADE: a dumpster goat, the Jaguars old logo, and the Pontiac crest.</figcaption></figure><p>The goal is not to replace every professional digitizer or pretend that machine embroidery can be fully automated with no tradeoffs. That would be dishonest.</p><p>Good digitizing still requires judgment. Fabric matters. Thread matters. Scale matters. Stitch density matters. Some artwork is a bad candidate. Some designs need manual cleanup. Some things that look great on a screen are going to sew terribly.</p><p>DADE is not magic.</p><p>What I am trying to build is a tool that removes some of the early friction.</p><p>Upload an image. Preview the stitch plan. Adjust the parts that matter. Export a machine-readable file. Learn enough from the process that embroidery digitizing feels less like a locked door.</p><p>The pitch is not “effortless professional embroidery in one click.” The pitch is: get from artwork to stitches without buying expensive software before you even know what you are doing. Less flashy. But it is a promise I can keep.</p><p>DADE costs me money every month, and at some point it has to charge for itself. I am close. But I cannot sell something I do not believe in yet, and the missing piece sounds small — let people fix their images after upload instead of before — but that’s shorthand for a workflow I have not had time to build. The truth is I do not want to charge for DADE. I also would not mind if this app became the company that got me out of writing regulated software. Those two feelings do not resolve cleanly, and I have stopped pretending they do.</p><p><strong>Update, September 2026</strong>: this resolved better than I expected. I built the missing piece, and DADE does charge now — but not the way this paragraph assumed. I did not want to charge people, so I designed around the free plan and put the paid tiers on the two things that genuinely cost me more when you use them: bigger files, and storage that sticks around. The free limits are as generous as my servers can be. The plan is for sponsorship to cover hosting, which is why the sponsor slot looks the same whether you have paid or not. Anyone who buys a tier is doing me a real favor, but free is the version I designed for.</p><h3>So why write this now?</h3><p>Partly because I regret not keeping a better devlog while building DADE. The commit history tells the truth, but it tells it in fragments. What it does not show is why any of it mattered.</p><p>And the truth is I never wrote down why it mattered, because the answer changes depending on the hour. There is a real gap in the market, and a real chance that filling it someday lets me work for myself. I have been a software engineer for seven years and have never shipped something I was proud of — cool things, sure, but nothing where my mom would understand why it was cool. I want to prove to myself that I can still do this before AI coding agents take all our jobs. And I want to ship version 1 before someone beats me to it. Pick one. On any given day they are all true.</p><p>But the reason I am writing this now is a pattern I have stopped ignoring: every time this project got better, it was because a stranger looked at it. A beginner on Reddit walked through my landing page and I rebuilt it. People with machines I will never own told me whether my files actually sewed. A tester I paid showed me the sharp edges I had quietly trained myself around. I am still one or two features from version 1, and I no longer believe the missing piece is something I can see from inside.</p><p>So this is me looking for more strangers.</p><p>The questions I am chasing now are about control. How much should a beginner see? How do I not bury them in controls? When should the app decide for you, and when should it ask? How much pre-processing can I expect a user to do? How do you explain a real limitation without making the tool feel broken? I do not have clean answers yet.</p><p>What I do have is the realization that embroidery digitizing is not just a computer vision problem, or a geometry problem, or a file export problem, or a UI problem. It is all of those things sitting on top of a physical craft.</p><p>And no — I never made the jacket. The project that was supposed to put my cat on a coat ate six months and produced a web app instead.</p><p>Lilly Pants did eventually get stitched. Version 1 shipped in August, and she came out of the machine as a patch, next to Olive, made for my wife rather than for me. A patch is not a jacket. I am taking the win anyway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8pQMBIusK_dd9vgPGV3O-A.jpeg" /><figcaption>Lilly Pants and Olive Oil, finally in thread. Nine months late, and not a jacket.</figcaption></figure><p>I am building DADE in public at <a href="https://dade-app.com/">https://dade-app.com</a>. If you have an embroidery machine, have fought with digitizing software, or have ever thought “surely converting this image should be easier than this,” I would like to hear where the rough edges are.</p><p>Because the biggest lesson so far is that the machine does exactly what the file tells it to do. The hard part is figuring out what the file should say.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1dc49255033" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Free OCR Tool to Organize Trading Cards — For My Brother, and Now for You]]></title>
            <link>https://medium.com/@jimmiestanley/i-built-a-free-ocr-tool-to-organize-trading-cards-for-my-brother-and-now-for-you-71849502c161?source=rss-31b80f112b5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/71849502c161</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[trading-cards]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ocr]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Jimmie Stanley]]></dc:creator>
            <pubDate>Sun, 18 May 2025 19:36:51 GMT</pubDate>
            <atom:updated>2025-05-18T19:39:20.015Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Built a Free OCR Tool to Organize Trading Cards — For My Brother, and Now for You</h3><p>My brother has boxes of Pokémon, Magic: The Gathering, and Yu-Gi-Oh cards. Like many collectors, he wanted to digitize his collection — not just for pride, but to track prices and prep for selling. The problem? Most tools are clunky, cloud-bound, or cost money. So I built him one.</p><p>That tool is now called <strong>CardScanner</strong>: a free, open-source desktop app that scans trading cards using OCR, names and organizes the files, and creates CSV summaries — optionally fetching real market prices from eBay.</p><p>Try it out here: <a href="https://github.com/jmtrafny/card-scanner">github.com/jmtrafny/card-scanner</a></p><h3>🧠 How It Works</h3><p>You drag in a folder of scanned card images. The app walks you through selecting text regions — like “Name”, “Set”, or “Number” — and uses Tesseract to extract the content. The first capture box becomes the filename, and all others become CSV columns.</p><p>Then, optionally, you can fetch prices from eBay using two strategies:</p><ul><li><strong>Median Price</strong> from recent sold listings</li><li><strong>Last Sold (filtered for outliers)</strong></li></ul><p>No signups, logins, or subscriptions. The whole thing runs offline until you fetch prices.</p><h3>🔬 Technical Deep Dive</h3><p>CardScanner is written in <strong>Python</strong> with a lightweight <strong>Tkinter GUI</strong>, styled using <strong>ttkbootstrap</strong> for a more modern feel. OCR is handled by <strong>Tesseract</strong>, with optional OpenCV-based preprocessing for sharper recognition when available.</p><h4>🧱 Modular Design</h4><ul><li><strong>main.py</strong>: Handles the full GUI lifecycle and user flow, including threading for long-running tasks like batch OCR and price fetching.</li><li><strong>region_selector.py</strong>: Presents a canvas-based interface for selecting named OCR bounding boxes. The first box is used as the filename.</li><li><strong>ocr_utils.py</strong>: Extracts and sanitizes text, optionally enhancing with OpenCV (e.g. adaptive thresholding + scaling for OCR accuracy).</li><li><strong>csv_logger.py</strong>: Writes scan results to a well-structured CSV file, using dynamically discovered attributes from bounding boxes.</li><li><strong>price_lookup.py</strong>: Opens the CSV, lets the user pick a column to use for pricing, and updates the file with fetched prices.</li><li><strong>ebay_provider.py</strong>: Uses requests + BeautifulSoup to scrape eBay sold listings, filters out bundles/lots, and computes pricing via median() or a filtered average.</li><li><strong>config_utils.py</strong>: Stores persistent config (paths, settings) as JSON under the user’s home directory.</li><li><strong>session_logger.py</strong>: Logs per-session scan and rename results into timestamped text files for auditability.</li></ul><p>The final output includes:</p><ul><li>Cleanly renamed image files</li><li>A CSV sheet with OCR results</li><li>A secondary CSV with appended price data</li><li>A plain text log file</li></ul><h4>⚡ Performance &amp; UX Considerations</h4><ul><li>OCR runs in a background thread to keep the UI responsive</li><li>User actions like folder selection and bounding box input are persisted across sessions</li><li>Region selection supports pan/zoom/scroll, with pixel-coordinates displayed per box</li><li>Price fetching respects throttling (~1 request every 2 seconds) to stay friendly to eBay</li></ul><h3>💡 Why I Built It</h3><p>Originally? Just for my brother.</p><p>But as we iterated, I realized there’s a gap for offline-first, transparent OCR tools for collectors. Especially tools that generate clean CSVs instead of Excel-locked files — something you can actually use with Google Sheets, scripts, or marketplaces.</p><p>So I polished it up and released it.</p><h3>⚙️ Key Features</h3><p><strong>OCR Regions</strong> — Define multiple text regions per card image</p><p><strong>Batch Rename</strong> — Uses OCR output to name files consistently</p><p><strong>Structured CSV Output</strong> — Each scan generates a clean, importable spreadsheet</p><p><strong>eBay Price Fetching</strong> — Appends real sale prices (no scraping abuse; throttled requests)</p><p><strong>No Excel Required</strong> — Outputs plain CSV, works in OpenOffice and Google Sheets</p><p><strong>Works Offline</strong> — Everything except price lookup works fully offline</p><p><strong>MIT Licensed</strong> — Free and open source</p><h3>🛠️ Built With</h3><ul><li><strong>Python + Tkinter</strong> for the GUI</li><li><strong>Pillow + pytesseract</strong> for OCR</li><li><strong>BeautifulSoup + requests</strong> for eBay lookups</li><li><strong>PyInstaller</strong> for packaging a Windows .exe</li><li><strong>ttkbootstrap</strong> for modern UI styling</li></ul><p>It’s fully open source under the <a href="https://github.com/jmtrafny/card-scanner/blob/main/LICENSE.txt">MIT License</a>.</p><h3>🧪 Build From Source</h3><p>If you don’t trust .exe files (and who does anymore?), it’s easy to run it yourself.</p><pre>git clone https://github.com/jmtrafny/card-scanner.git<br>cd card-scanner<br>python -m venv .venv<br>.venv\Scripts\activate<br>pip install -r requirements.txt<br>python src/main.py</pre><p>Instructions are on GitHub: <a href="https://github.com/jmtrafny/card-scanner">github.com/jmtrafny/card-scanner</a></p><h3>❤️ From My Workbench to Yours</h3><p>What started as a weekend project for one collector might just help others too. If you’re sorting old binders, pricing your pulls, or just want some structure in your collection — give it a try.</p><p>I’d love feedback, forks, or just to hear if it saved you some time.</p><p>— <strong>Jimmie Stanley</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71849502c161" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ten Rules for Safer and More Secure Java in Regulated Industries]]></title>
            <link>https://medium.com/@jimmiestanley/ten-rules-for-safer-and-more-secure-java-in-regulated-industries-c49dcacf9f5d?source=rss-31b80f112b5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c49dcacf9f5d</guid>
            <category><![CDATA[code-style]]></category>
            <category><![CDATA[coding-standards]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Jimmie Stanley]]></dc:creator>
            <pubDate>Fri, 14 Mar 2025 19:47:22 GMT</pubDate>
            <atom:updated>2026-06-12T23:18:41.681Z</atom:updated>
            <content:encoded><![CDATA[<p>Inspired by NASA’s “<a href="https://www.spinroot.com/p10/">Power of Ten</a>” guidelines, this coding standard proposes a concise yet strict set of rules for developing safe and secure Java systems in regulated industries such as aviation, healthcare, finance, and energy. These fields demand high reliability, security, and traceability due to compliance requirements like FAA, FDA, SEC, NERC CIP, and GDPR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*LbjCfBt_G8AoFmtmw4RGAg.png" /></figure><p>In regulated industries like aviation, software development must adhere to strict standards to ensure security, maintainability, and reliability. However, when coding standards become too complex, they can create inefficiencies rather than improving software quality. Our official coding standard consists of 140 rules tracked in an Excel spreadsheet. With so many rules, no one can realistically remember them all, and in practice, pull requests often devolve into a checklist exercise. While some rules address critical concerns like security and maintainability, a significant portion focuses on formatting details — whitespace, import order, or how many closing stars should appear in a Javadoc block.</p><p>Standardizing style is important, but when every merge request is subjected to a 65-point manual checklist — much of which covers elements optimized away by the compiler — it shifts the focus from writing reliable, secure software to enforcing arbitrary formatting rules. Checking whitespace conformity is easy; verifying functionality, security, and integration is hard. The more time spent policing minor style infractions, the less time remains for reviewing the logic and robustness of the code itself. At a certain point, the effort put into enforcing style outweighs any benefit gained from having a standardized codebase.</p><p>To address this, I took inspiration from NASA’s <em>Power of Ten</em> approach, which emphasizes a small, high-impact rule set that is practical, enforceable, and meaningful. If we can distill coding guidelines down to ten core rules that every developer knows and understands, specific implementation details can flow naturally from there. The current approach — documenting every possible rule, automating what’s feasible, and manually enforcing the rest — has been challenging in practice. A smaller, high-impact rule set allows developers to focus on what truly matters: writing secure, maintainable software instead of getting caught up in formatting debates.</p><p><em>Let’s start a conversation about what actually makes Java software safer, more secure, and more maintainable in real-world regulated environments.</em></p><h3>Rule 1: Keep control flow simple and loops bounded.</h3><p>Rationale: Use only straightforward control structures. Do not use recursion, and avoid any form of “goto-like” jumps such as labeled break/continue that make code flow hard to follow. Simple, linear control flow is easier to analyze and test, and it prevents unpredictable paths. Banning recursion guarantees an acyclic call graph, which enables static analyzers to reason about program behavior more effectively. Likewise, every loop must have a well-defined termination condition or an explicitly fixed upper bound. This makes it possible for tools to prove that the loop cannot run away indefinitely. (If a loop is truly intended to be non-terminating — for example, an event processing thread — this must be clearly documented, and it should be provable that the loop will not exit unexpectedly.) Keeping control flow simple and bounded ensures the software will not get stuck in endless cycles or obscure logic, improving overall stability.</p><p>Enforcement: Static analysis can detect direct or indirect recursion and flag it (since any recursive call creates a cycle in the call graph). Loops without obvious exit conditions or upper bounds (e.g., while(true) with no breaks) can be caught by analyzers or linters. Many linters (SonarQube, PMD, etc.) have rules to warn on infinite loops or overly complex flow. Use these tools to automatically enforce simplicity in control structures.</p><h3>Rule 2: Manage resources and memory deterministically — no leaks or uncontrolled allocation.</h3><p>Rationale: Even though Java has garbage collection, do not rely on it for timely resource management. All file handles, network sockets, database connections, and similar resources must be closed or released as soon as they are no longer needed. Use try with-resources or finally blocks to ensure deterministic cleanup. This prevents resource exhaustion and memory leaks that could impair long-running system stability. Unrestrained allocation or failure to free resources can lead to unpredictable behavior and performance degradation. In safety-critical environments, memory usage should be predictable; garbage collectors can have non-deterministic pause times that may disrupt real-time operations. By preallocating what you need and reusing objects (or using object pools) where feasible, you minimize jitter and avoid out-of-memory failures.</p><p>Additionally, do not use mechanisms that bypass Java’s memory safety (e.g. sun.misc.Unsafe, manual off-heap allocations, or custom classloaders that could duplicate classes) unless absolutely necessary and thoroughly reviewed. Such mechanisms can introduce memory corruption or security issues similar to C’s manual memory errors, defeating Java’s safety features.</p><p>Enforcement: Configure static analysis tools (like SpotBugs/FindBugs, SonarQube) to check for opened streams/sockets that are not closed. Many tools have rules for detecting forgotten close() calls or misuse of resources (e.g., SonarQube has rules to ensure using try-with-resources for AutoCloseable). Memory-analysis tools can warn if objects are being created in a loop or if finalizers are used (which is discouraged). Disable or forbid the use of finalize() in code (it’s deprecated and unpredictable), which can be enforced by style checkers. For low-level unsafe API usage, tools like ErrorProne or PMD can flag references to forbidden classes (Unsafe, JNI, etc.). All these help ensure resources are handled in a controlled, predictable way.</p><h3>Rule 3: Limit function/method size and complexity.</h3><p>Rationale: No single method should be so large that it cannot fit on one screen or page. As a guideline, aim for ~50–60 lines of code per method (excluding comments) as an upper limit. Keeping methods short and focused makes them easier to understand, test, and verify as independent units. Excessively long or complex methods are a sign of poorly structured code — they make maintenance harder and can hide defects. Smaller methods promote better traceability (each method does one thing that can be linked to specific requirements or design descriptions) and encourage code reuse. They also reduce cognitive load on reviewers and static analyzers, which may struggle with very large routines.</p><p>Furthermore, limit the cyclomatic complexity of each method (e.g., number of independent paths) to a low number (such as 10 or 15). This ensures the control flow within a method remains simple and testable. High complexity correlates with error proneness.</p><p>Enforcement: Use static code analysis tools or linters (Checkstyle, PMD, or SonarQube) to enforce limits on method length and complexity. For example, Checkstyle’s MethodLength rule or SonarQube’s cognitive complexity check can flag methods exceeding the set threshold. These tools make it easy to automatically detect when a function has grown too large or complex, so it can be refactored early. Teams should set strict limits in these tools; many regulated projects set the limit in stone and fail the build on violations.</p><h3>Rule 4: Declare data at the smallest feasible scope, and prefer immutability.</h3><p>Rationale: Follow the principle of least exposure for variables and state. Declare each variable in the narrowest scope (inner block or method) where it’s needed. This reduces the chances of unintended interactions or modifications, since code outside that scope cannot even see the variable. Keeping scope tight also aids traceability: if a value is wrong, there are fewer places to check where it could have been set. It discourages reuse of variables for multiple purposes, which can be confusing and hinder debugging.</p><p>Likewise, avoid using mutable global state. In Java, that means minimize public static variables (especially mutable ones) and shared singleton objects. Instead, pass needed data as parameters or use dependency injection, which makes the flow of data explicit and testable. Where global or shared state is necessary (for example, configuration or caches), make those variables private and if possible final (immutable after construction). Immutability greatly improves safety by preventing unexpected changes and makes concurrent code much easier to reason about.</p><p>Following this rule enhances security as well — for instance, an object that is not in scope can’t be altered or misused by unrelated parts of the program. It also improves stability: localized variables reduce unintended side effects across the system.</p><p>Enforcement: Modern static analyzers can often detect if a variable could be declared in a narrower scope or if a field can be made final. For example, IntelliJ IDEA inspections and SonarQube rules will suggest when a field or local variable is overly scoped. Enforce coding style rules that prohibit non-constant public static fields and flag any mutable static as a potential error. Code reviewers and tools like PMD (with rules like AvoidUsingStaticFields) can catch instances of unwarranted global state. Additionally, incorporate tools or IDE settings to highlight variables that are used only in a small region but declared globally, prompting developers to reduce their scope.</p><h3>Rule 5: Validate all inputs and sanitize data across trust boundaries.</h3><p>Rationale: Treat all external or untrusted inputs as potentially malicious or malformed. Whether the data comes from user interfaces, networks, files, or other systems, it must be validated before use. This includes checking that inputs meet expected formats, ranges, and length limits, and sanitizing them to remove or neutralize any dangerous content. For example, if the software processes messages or commands, ensure each field is within allowed bounds and characters (to prevent injection attacks or buffer overruns in lower-level systems). Ground systems often interface with aircraft data and other services, so this rule prevents bad data from propagating into critical operations or databases.</p><p>Unvalidated inputs can lead to unpredictable behavior or security vulnerabilities. As the CERT Java secure coding guidelines state, software often has to parse input strings with internal structure, and if that data isn’t sanitized, the subsystem may be “unprepared to handle the malformed input” or could suffer an injection attack (<a href="https://www.informit.com/articles/article.aspx?p=1751371&amp;seqNum=3#:~:text=Many%20programs%20accept%20untrusted%20data,may%20include%20an%20injection%20attack">IDS00-J</a>). By validating inputs, we ensure the software either cleans up or rejects bad data early (fail fast), maintaining stability and security.</p><p>This rule also supports traceability: by enforcing strict input formats and logging validation failures (see Rule 7 on logging), you create an audit trail of bad data events, which is important in regulated environments. It must always be clear what data was received and how the system reacted.</p><p>Enforcement: Use libraries and tools to help with input validation (e.g., Apache Commons Validator, Hibernate Validator for bean validation). Static analysis tools can detect some improper usage patterns — for instance, taint analysis (as in Fortify, Checkmarx, or FindSecBugs) can trace untrusted data and ensure it’s sanitized before use in sensitive operations (like executing a command or constructing SQL queries). Custom linters or code review checklists should flag any direct use of external data that hasn’t been checked. Additionally, define and use strong typing or objects for critical data (e.g., use a FlightID value object rather than a raw string) to force validation at construction. This makes it easier for automated tools to enforce that only valid data gets in. In summary, never pass raw unvalidated input to critical logic– and have your CI pipeline include security scanners that will catch common injection or formatting issues if validation is missing.</p><h3>Rule 6: Handle errors and exceptions explicitly — never ignore failures.</h3><p>Rationale: Every error code or exception must be checked and handled in a way that preserves system integrity. In Java, this means do not catch exceptions just to drop them; and do not ignore return values that indicate errors. If a called method can fail (either by returning an error flag/code or throwing an exception), the code must anticipate that. Failing to do so can leave the system in an inconsistent or insecure state (<a href="https://wiki.sei.cmu.edu/confluence/display/java/ERR00-J.+Do+not+suppress+or+ignore+checked+exceptions#:~:text=Ignoring%20or%20suppressing%20exceptions%20can,result%20in%20inconsistent%20program%20state">ERR00-J</a>). For example, if an exception is thrown but caught with an empty catch block, the program will continue as if nothing happened — potentially with incorrect assumptions because some operation actually failed. The CERT standard strongly warns that ignoring exceptions can lead to unpredictable behavior and state corruption.</p><p>In practice, this rule means: always catch only those exceptions you can meaningfully handle, and at an appropriate level. If you catch an exception, either take corrective action or if you cannot handle it, log it and rethrow it (or throw a wrapped exception) so that the failure is not lost. Never do a “swallowing” catch (e.g., catching Exception or any exception and doing nothing or just a comment) — this is strictly disallowed. Similarly, if a method returns an error indicator (like a boolean or special value), don’t ignore it; handle the error or propagate it upward. By consistently handling errors, we maintain traceability (every failure is accounted for) and stability (system can fail gracefully or recover).</p><p>Note: In highly regulated systems, you often need to demonstrate to auditors that no error is neglected. This rule ensures that. Even for seemingly harmless cases (like ignoring a close() failure on a log file), make a conscious decision — either handle it or explicitly document why it’s safe to ignore (though truly safe-to-ignore cases are rare).</p><p>Enforcement: Many static analysis tools can catch ignored exceptions or error codes. For example, SonarQube has a rule detecting empty exception handlers and will flag them as issues. Parasoft Jtest includes a check for CERT ERR00-J (do not ignore exceptions) and can enforce that all caught exceptions are either logged or rethrown. Similarly, SpotBugs has patterns to find empty catch blocks or broad catches. Enable these rules in your build. Additionally, configure your IDE or code reviews to highlight any catch(Exception e) or catch(Throwable t)– these broad catches often indicate a potential to swallow unintended exceptions; they should be replaced with specific exceptions or handled with extreme care. By using these tooling checks, any instance of an ignored error will be caught as a violation. Teams should treat such violations with high priority, as they represent latent bugs.</p><h3>Rule 7: Use robust logging and auditing for observability and traceability.</h3><p>Rationale: All significant events, decisions, and errors in the system should be logged. In a regulated aviation ground system, observability is crucial — you need to be able to reconstruct what happened after the fact, both for debugging and for compliance (audit trails). Logging provides a runtime trace of the system’s behavior. Ensure that every error (exception) is logged with enough context to diagnose it later (e.g., include relevant IDs, parameters, or state in the log message). Likewise, log important state transitions or actions (for example, sending a command to an aircraft, or switching system modes) so that there is a record. This greatly aids traceability, since one can map log entries to specific requirements or procedures (e.g., a requirement “system shall record all command acknowledgments” is fulfilled by corresponding log statements).</p><p>Logs should use a consistent structure and be at an appropriate level (INFO for normal significant events, WARN/ERROR for problems, DEBUG for detailed troubleshooting data). Importantly, do not rely on System.out.println or System.err for logging; use a proper logging framework (such as SLF4J with Log4j/Logback) that can be configured, filtered, and directed to persistent storage with timestamps. This ensures logs are thread-safe, properly formatted, and can integrate with monitoring systems.</p><p>In addition, never log sensitive information in plaintext. Since some ground systems may handle ITAR-controlled or otherwise sensitive data, make sure not to expose passwords, keys, or sensitive personal info in logs. If such data must be recorded, consider masking or encrypting it, or directing it to a secure audit log with access controls.</p><p>Overall, comprehensive logging makes the system more transparent and maintainable without altering its behavior, and is invaluable for investigating issues. It’s better to err on the side of too much relevant information in logs (with proper log levels) than too little, especially in an environment where post-incident review is critical.</p><p>Enforcement: While logging itself is a runtime concern, static analysis can enforce logging practices by checking for certain patterns. For instance, linters can flag any empty catch block (as per Rule 6) or any catch that only rethrows without logging encourage at least logging the exception at the point it is caught (unless it’s being rethrown to be logged at a higher level). Custom static rules or aspects can ensure that every public-facing method or service call has logging of its entry/exit or key actions. You can also use aspect oriented tools or frameworks (like Spring AOP with an @Audit annotation) to inject logging, but the presence of those annotations or calls can be checked. Moreover, you can configure detection of System.out or System.err calls in code (Checkstyle has a rule to ban them), to enforce usage of the designated logging framework. Another practice is to use unit tests or integration tests to verify that critical actions produce log entries (for example, using appenders that accumulate messages). While not purely static analysis, this automated test approach combined with static checks for absence of bad patterns (like System.out) helps maintain logging discipline.</p><h3>Rule 8: Avoid reflection, runtime metaprogramming, and other unsafe language features.</h3><p>Rationale: Do not use Java reflection or similar dynamic features (like Class.forName(), Method.invoke(), or modifying access controls) unless absolutely unavoidable. Reflection breaks the static type safety of Java and can bypass normal encapsulation, making code harder to analyze and secure. The use of reflection is known to complicate security analysis and can introduce hidden vulnerabilities (<a href="https://wiki.sei.cmu.edu/confluence/display/java/SEC05-J.+Do+not+use+reflection+to+increase+accessibility+of+classes,+methods,+or+fields#:~:text=Use%20of%20reflection%20complicates%20security,use%20of%20reflection%20is%20necessary">SEC05-J</a>). For instance, malicious input combined with reflection can instantiate unexpected classes or alter private fields, defeating security measures. It also impairs traceability and observability — if code is being invoked via reflection, static analysis tools may not understand those calls, and it’s harder to ensure all paths are logged or checked.</p><p>Similarly, avoid dynamic class loading from arbitrary sources, bytecode generation, or self-modifying code. These techniques can produce unpredictable behavior and are hard to certify in a regulated context. They also pose potential ITAR compliance issues if code or plugins can be introduced from outside the controlled baseline. In an audited environment, we want all execution paths and classes to be known at compile-time if possible.</p><p>Finally, do not use native code (JNI) unless absolutely necessary. Native code bypasses Java’s safety and can introduce memory corruption or security issues that the JVM would normally prevent. If native libraries must be used (for example, for a hardware interface), isolate and sandbox them, and apply equivalent rules (like memory management, error checking) to that code as well. Keep the native interface layer minimal and well-documented.</p><p>Enforcement: Static analysis can catch use of reflection APIs. Tools like SonarQube and PMD have rules or custom regex checks to detect java.lang.reflect usage or calls to ClassLoader and Class.forName. If your project has no legitimate need for reflection, treat any such occurrence as a violation. Similarly, flag the use of java.lang.reflect.Field.setAccessible(true) or other methods that alter accessibility — these should be banned (CERT has rules for this). For dynamic loading, check for usage of custom class loaders or OSGi-like dynamic modules; these should be reviewed carefully. To enforce the JNI restriction, ban the usage of System.loadLibrary and native method declarations via automated checks. Many linters allow you to specify forbidden method calls or classes make use of that to make these rules enforceable by the build. The goal is to have the static analyzer break the build or warn loudly if any reflection or dynamic code execution is introduced, so it can be justified or removed.</p><h3>Rule 9: Design for concurrency safety — no data races or unsynchronized access to shared state.</h3><p>Rationale: Ground systems are often multi-threaded (handling concurrent connections, data streams, etc.), so thread safety must be built-in by design. Any access to shared mutable state must be properly synchronized or guarded by thread-safe constructs. Failing to do so can cause erratic bugs that are hard to reproduce and debug, undermining system stability. Race conditions, deadlocks, and concurrency-related crashes have caused serious issues in the past, so we apply a strict discipline to prevent them.</p><p>Key practices include: use high-level concurrency utilities from java.util.concurrent (like thread-safe collections, semaphores, thread pools) instead of low-level threads and locks whenever possible. If you must use low-level synchronized blocks or Lock objects, clearly document the locking strategy (which locks guard which data, and in what order they are acquired) to avoid deadlocks. Never access a shared variable from multiple threads without synchronization (or making it volatile/atomic as appropriate for the use case). Immutable objects are inherently thread-safe, so prefer immutability for data that can be accessed from multiple threads. For example, use immutable data transfer objects or copy-on-write patterns for configurations.</p><p>Do not use deprecated or dangerous thread methods like Thread.stop() or suspend()– they are unsafe and can leave monitors locked. Instead, use interruption and proper shutdown mechanisms for threads. Always ensure threads are given meaningful names and have exception handling (uncaught exception handlers) so that no thread fails silently. In a regulated environment, it’s particularly important to guarantee deterministic behavior; concurrency issues are by nature nondeterministic, so we proactively avoid them.</p><p>Enforcement: Static analysis for concurrency is an evolving field, but some tools exist (e.g., ThreadSafe analyzer, Java Concurrency static analysis in SonarQube) that can detect common mistakes. For instance, SonarQube can flag usage of Collections.synchronizedCollection with manual synchronization or misuse of wait()/notify() patterns. It can also detect if a field is apparently accessed from multiple threads without synchronization (though proving that statically is hard). At the very least, configure your analysis tools to ban the known bad practices: flag any use of Thread.stop or suspend (they should be errors). Tools like Checkstyle/PMD can forbid creating Threads directly in favor of using an Executor service. Also, enforce that shared collections are from java.util.concurrent (e.g., use ConcurrentHashMap instead of a synchronized HashMap with manual locks). Code reviews and pairing with static analysis should specifically look for any synchronized usage and verify that it’s correct and covers all accesses. You can use annotations like @ThreadSafe and @NotThreadSafe (from JSR-305 or javax.annotation) on classes and have tools like SpotBugs check consistency (SpotBugs has checks for atomicity and consistency with these annotations). By combining these measures, many concurrency issues can be caught or prevented early, ensuring the system remains stable under multi-threaded conditions.</p><h3>Rule 10: Enable all compiler warnings and use multiple static analysis tools — zero warnings policy.</h3><p>Rationale: All code must compile with the strictest compiler warnings enabled, and with 0 warnings. Treat compiler warnings as errors; they often indicate real problems or risky code. In addition, the codebase must be checked frequently (preferably with every build) by static analysis tools– and the goal is to have zero outstanding static analysis warnings as well. Static analyzers can catch a wide range of issues (security vulnerabilities, bugs, style violations) that human reviewers might miss. In a safety-critical or high-reliability project, it’s simply unacceptable to ignore these signals. As NASA’s guidelines note, there is no excuse today not to use the many effective static analyzers available, and their use “should not be negotiable” on serious software projects.</p><p>Different analyzers have different strengths, so using more than one can provide a safety net (one might catch what another misses). For example, you might use SpotBugs (which finds common bug patterns), PMD or Checkstyle (for coding standard enforcement), SonarQube (which integrates many rules including security rules from CERT and MISRA), and a specialized security scanner like OWASP Dependency Check (to catch vulnerable libraries) or FindSecBugs (for security bug patterns). By running these regularly (automated in CI), you maintain a continuously inspectable code health. Adopting a zero-warning policy means if a tool flags an issue, developers must resolve it either by fixing the code or justifying it (and possibly adjusting the rule set) — but never simply ignore it. This discipline prevents “warning fatigue” and ensures the code remains clean.</p><p>For traceability, this rule also helps because many static analysis tools can be configured to check for the presence of certain comments or annotations (for instance, you could have a custom rule that every method has a reference to a requirement ID in a comment). While this is project-specific, integrating those checks into your analysis guarantees that traceability requirements (like each requirement mapped to code and each code piece mapped to requirements) are continuously verified.</p><p>Enforcement: This rule is about using tools as enforcement. Configure the Java compiler (javac) with-Xlint:all and treat warnings as errors (-Werror) in your build scripts, so any warning breaks the build. Adopt at least one static code analysis platform (SonarQube is common in industry and can enforce a quality gate of zero critical issues). Additionally, run auxiliary analyzers: for example, integrate SpotBugs into the build (there are Maven/Gradle plugins for SpotBugs), and Checkstyle/PMD with a curated ruleset that includes all the above rules (many of the rules described here have corresponding Checkstyle/PMD checks or can be implemented with custom rules). Tools like Coverity or Parasoft can be used for deeper analysis if available — these are used in industry (Parasoft Jtest, Polyspace, CodeSonar etc. have strong analysis for critical systems). The key is to make analysis automatic and mandatory: no code should be merged unless it passes all static checks with zero warnings. By imposing this gate, compliance with the standard becomes a built-in part of development, not a separate effort. This automates rigor in a way manual code reviews cannot easily match, and provides evidence (logs from analysis tools) that you are meeting the safety and security standards required for FAA certification and ITAR compliance.</p><h3>References</h3><ol><li>Holzmann, Gerard J.- <a href="https://markdownlivepreview.com/uploads/c8099a62a5c6e478a7f64b9cae7cba25/P10.pdf">The Power of Ten — Rules for Developing Safety Critical Code</a>. NASA/JPL, 2006. This is the original “Power of Ten” document that inspired the structure and strict coding rules.</li><li>NASA’s Software Assurance and Software Safety Standard (NASA-STD-8739.8A) Provides additional safety and reliability considerations for software development in regulated environments.</li><li>FAA Advisory Circular AC 20–115D- Airborne Software Development Assurance Using DO-178C. While not directly applicable to ground systems, DO-178C principles inform structured, verifiable software development for aviation.</li><li>MISRA Java Guidelines (MISRA-C:2012 Adaptations for Java) Industry best practices for safety and reliability in automotive and aviation software.</li><li>CERT Secure Coding Guidelines for Java (SEI CERT, Carnegie Mellon University) Covers security best practices, especially for input validation, error handling, and memory/resource management.</li><li>NIST SP 800–53 &amp; NIST SP 800–218 (Secure Software Development Framework) Security controls relevant to ITAR and FAA compliance, including logging, audit trails, and input validation.</li><li>OWASP Secure Coding Practices Guide References for secure Java coding, particularly for logging, exception handling, and input validation.</li><li>SonarQube, SpotBugs, PMD, Checkstyle, Parasoft Jtest Static analysis tools used to enforce automated verification of code quality, security, and maintainability.</li><li>Goetz, Brian, et al.- Java Concurrency in Practice. The basis for the concurrency rules regarding synchronization, thread safety, and proper handling of shared state.</li><li>Gosling, James, et al.- Java Language Specification (JLS) &amp; Effective Java (Joshua Bloch). For ensuring Java best practices related to immutability, method length, and scope restrictions.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c49dcacf9f5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>