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

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      June 4, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 4, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 4, 2025

      Smashing Animations Part 4: Optimising SVGs

      June 4, 2025

      I test AI tools for a living. Here are 3 image generators I actually use and how

      June 4, 2025

      The world’s smallest 65W USB-C charger is my latest travel essential

      June 4, 2025

      This Spotlight alternative for Mac is my secret weapon for AI-powered search

      June 4, 2025

      Tech prophet Mary Meeker just dropped a massive report on AI trends – here’s your TL;DR

      June 4, 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

      Beyond AEM: How Adobe Sensei Powers the Full Enterprise Experience

      June 4, 2025
      Recent

      Beyond AEM: How Adobe Sensei Powers the Full Enterprise Experience

      June 4, 2025

      Simplify Negative Relation Queries with Laravel’s whereDoesntHaveRelation Methods

      June 4, 2025

      Cast Model Properties to a Uri Instance in 12.17

      June 4, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      My Favorite Obsidian Plugins and Their Hidden Settings

      June 4, 2025
      Recent

      My Favorite Obsidian Plugins and Their Hidden Settings

      June 4, 2025

      Rilasciata /e/OS 3.0: Nuova Vita per Android Senza Google, Più Privacy e Controllo per l’Utente

      June 4, 2025

      Rilasciata Oracle Linux 9.6: Scopri le Novità e i Miglioramenti nella Sicurezza e nelle Prestazioni

      June 4, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: No Limits on Repetition

    CodeSOD: No Limits on Repetition

    February 3, 2025

    Just because you get fired doesn’t mean that your pull requests are automatically closed. Dallin was in the middle of reviewing a PR by Steve when the email came out announcing that Steve no longer worked at the company.

    Let’s take a look at that PR, and maybe we can see why.

                        $originalUndrawn = DecimalHelper::toDecimal($party->limit)->sub(DecimalHelper::toDecimal($party->drawn));
    

    This is the original code, which represents operations on investments. An investment is represented by a note, and belongs to one or more partys. The amount that can be drawn is set by a limit, which can belong to either the party or the note.

    What our developer was tasked with doing was allow a note to have no limit. This means changing all the places where the note‘s limit is checked. So this is what they submitted:

                        if ($note->limit == null) {
                            $originalUndrawn = DecimalHelper::toDecimal($party->limit)->sub(DecimalHelper::toDecimal($party->drawn));
                        } else {
                            $originalUndrawn = DecimalHelper::toDecimal($party->limit)->sub(DecimalHelper::toDecimal($party->drawn));
                        }
    

    You’ll note here that the note limit isn’t part of calculating the party limits, so both branches do the same thing. And then there’s the deeper question of “is a null really the best way to represent this?” especially given that elsewhere in the code they have an “unlimited” flag that disables limit checking.

    Now, Steve wasn’t let go only for their code- they were just a miserable co-worker who liked to pick fights in pull request comments. So the real highlight of Steve’s dismissal was that Dallin got to have a meaningful discussion about the best way to make this change with the rest of the team, and Steve didn’t have a chance to disrupt it.

    [Advertisement]
    Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.

    Source: Read More 

    Hostinger
    Facebook Twitter Reddit Email Copy Link
    Previous ArticleHow to Fix Spotify ‘No PubKey’ Error on Ubuntu
    Next Article bower – curses frontend for the Notmuch email system

    Related Posts

    News & Updates

    I test AI tools for a living. Here are 3 image generators I actually use and how

    June 4, 2025
    News & Updates

    The world’s smallest 65W USB-C charger is my latest travel essential

    June 4, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    10 ways to create more sustainable websites

    Web Development

    Dell wants to be your one-stop shop for enterprise AI infrastructure

    News & Updates

    App fatigue is real: Users are downloading fewer apps than ever

    News & Updates

    Crypto Scammers Hijack Channel 7 News Australia’s YouTube Account, Use Elon Musk Deepfake to Ask for Crypto Investment

    Development
    Hostinger

    Highlights

    Artificial Intelligence

    The multifaceted challenge of powering AI

    January 21, 2025

    Artificial intelligence has become vital in business and financial dealings, medical care, technology development, research,…

    CVE-2025-5506 – TOTOLINK A3002RU Cross-Site Scripting in NAT Mapping Page

    June 3, 2025

    How Small Businesses Can Leverage React Native for Big Growth📈

    April 24, 2025

    CVE-2025-24350 – CtrlX OS Certificates and Keys Arbitrary File Write Vulnerability

    April 30, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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