Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      From Data To Decisions: UX Strategies For Real-Time Dashboards

      September 13, 2025

      Honeycomb launches AI observability suite for developers

      September 13, 2025

      Low-Code vs No-Code Platforms for Node.js: What CTOs Must Know Before Investing

      September 12, 2025

      ServiceNow unveils Zurich AI platform

      September 12, 2025

      Building personal apps with open source and AI

      September 12, 2025

      What Can We Actually Do With corner-shape?

      September 12, 2025

      Craft, Clarity, and Care: The Story and Work of Mengchu Yao

      September 12, 2025

      Distribution Release: Q4OS 6.1

      September 12, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Optimizely Mission Control – Part III

      September 14, 2025
      Recent

      Optimizely Mission Control – Part III

      September 14, 2025

      Learning from PHP Log to File Example

      September 13, 2025

      Online EMI Calculator using PHP – Calculate Loan EMI, Interest, and Amortization Schedule

      September 13, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      sudo vs sudo-rs: What You Need to Know About the Rust Takeover of Classic Sudo Command

      September 14, 2025
      Recent

      sudo vs sudo-rs: What You Need to Know About the Rust Takeover of Classic Sudo Command

      September 14, 2025

      Dmitry — The Deep Magic

      September 13, 2025

      Right way to record and share our Terminal sessions

      September 13, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: A Real POS Report

    CodeSOD: A Real POS Report

    June 9, 2025

    Eddie‘s company hired a Highly Paid Consultant to help them retool their systems for a major upgrade. Of course, the HPC needed more and more time, and the project ran later and later and ended up wildly over budget, so the HPC had to be released, and Eddie inherited the code.

    What followed was a massive crunch to try and hit absolutely hard delivery dates. Management didn’t want their team “rewriting” the expensive code they’d already paid for, they just wanted “quick fixes” to get it live. Obviously, the HPC’s code must be better than theirs, right?

    After release, a problem appeared in one of their sales related reports. The point-of-sale report was meant to deliver a report about which items were available at any given retail outlet, in addition to sales figures. Because their business dealt in a high volume of seasonal items, every quarter the list of items was expected to change regularly.

    The users weren’t seeing the new items appear in the report. This didn’t make very much sense- it was a report. The data was in the database. The report was driven by a view, also in the database, which clearly was returning the correct values? So the bug must be in the code which generated the report…

    <span class="hljs-keyword">If</span> POSItemDesc = <span class="hljs-string">"Large Sign"</span> <span class="hljs-keyword">Then</span>
            grdResults.Columns.FromKey(<span class="hljs-string">"FColumn12"</span>).Header.Caption = <span class="hljs-string">"Large Sign"</span>
    <span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    <span class="hljs-keyword">If</span> POSItemDesc = <span class="hljs-string">"Small Sign"</span> <span class="hljs-keyword">Then</span>
            grdResults.Columns.FromKey(<span class="hljs-string">"FColumn12"</span>).Header.Caption = <span class="hljs-string">"Small Sign"</span>
    <span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    <span class="hljs-keyword">If</span> POSItemDesc = <span class="hljs-string">"2x2 Hanging Sign"</span> <span class="hljs-keyword">Then</span>
            grdResults.Columns.FromKey(<span class="hljs-string">"FColumn12"</span>).Header.Caption = <span class="hljs-string">"2x2 Hanging Sign"</span>
    <span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    <span class="hljs-keyword">If</span> POSItemDesc = <span class="hljs-string">"1x1 Sign"</span> <span class="hljs-keyword">Then</span>
            grdResults.Columns.FromKey(<span class="hljs-string">"FColumn12"</span>).Header.Caption = <span class="hljs-string">"1x1 Sign"</span>
    <span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    <span class="hljs-comment">'.........Snipping more of these........</span>
    <span class="hljs-keyword">If</span> POSItemDesc = <span class="hljs-string">"Light Thief"</span> <span class="hljs-keyword">Then</span>
            grdResults.Columns.FromKey(<span class="hljs-string">"FColumn12"</span>).Header.Caption = <span class="hljs-string">"Light Thief"</span>
    <span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    <span class="hljs-keyword">If</span> POSItemDesc = <span class="hljs-string">"Door Strike"</span> <span class="hljs-keyword">Then</span>
            grdResults.Columns.FromKey(<span class="hljs-string">"FColumn12"</span>).Header.Caption = <span class="hljs-string">"Door Strike"</span>
    <span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    

    First, it’s worth noting that inside of the results grid display item, the HPC named the field FColumn12, which is such a wonderfully self documenting name, I’m surprised we aren’t all using that everywhere. But the more obvious problem is that the list of possible items is hard-coded into the report; items which don’t fit one of these if statements don’t get displayed.

    At no point, did the person writing this see the pattern of “I check if a field equals a string, and then set another field equal to that string,” and say, “maybe there’s a better way?” At no point, in the testing process, did anyone try this report with a new item?

    It was easy enough for Eddie to change the name of the column in the results grid, and replace all this code with a simpler: grdResults.Columns.FromKey("POSItem").Header.Caption = POSItemDesc, which also had the benefit of actually working, but we’re all left puzzling over why this happened in the first place. It’s not like the HPC was getting paid per line of code. Right? Right?

    Of course not- no HPC would willingly be paid based on any metric that has an objective standard, even if the metric is dumb.

    [Advertisement]
    ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleTactics – football lineup builder
    Next Article Fine del Supporto per Linux Mint 20.x

    Related Posts

    News & Updates

    Building personal apps with open source and AI

    September 12, 2025
    News & Updates

    What Can We Actually Do With corner-shape?

    September 12, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    May 2025 Baseline monthly digest

    Development

    CVE-2025-54886 – Skops Remote Code Execution Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-49259 – Thembay Hara PHP Remote File Inclusion Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-46524 – Stesvis WordPress CSRF Stored XSS

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    News & Updates

    China’s Giving NVIDIA the Side-Eye — H20 AI GPUs Face Major Trust Issues As Beijing Authorities Urge Avoidance

    August 12, 2025

    Just when NVIDIA thought it was in the clear to resume sales of its H20…

    The Hidden Risks of SaaS: Why Built-In Protections Aren’t Enough for Modern Data Resilience

    June 26, 2025

    I replaced my ThinkPad with this Lenovo tablet for a week – and it was pretty dang close

    July 31, 2025

    Your Slack app is getting a big upgrade – here’s how to try the new AI features

    June 29, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.