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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

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

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 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

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»CodeSOD: IsEmptyOrNullOrNullOrEmpty

    CodeSOD: IsEmptyOrNullOrNullOrEmpty

    August 28, 2024

    Peter was tracking down some bugs, when he found code which looks like this:

    if (IsEmptyOrNull(myInput))
    {
    // do things that clearly expect myInput to NOT be null or empty
    } else {
    throw BadInputException(“The input must not be null.”);
    }

    Names are made up above, to illustrate the flow of code.

    This seemed wildly wrong, and was possibly the source of the bug, so Peter dove in. Unfortunately, this wasn’t the bug. You see, IsEmptyOrNull is not a built-in function. But it wraps one.

    public bool IsEmptyOrNull(string param1)
    {
    return !String.IsNullOrEmpty(param1);
    }

    Wrapping a small built-in function is already a code smell. Making the name almost identical but not quite is also a code smell. But reversing the meaning because you reversed the name is absolutely bonkers.

    Did they think that A or B != B or A? Because that’s what this implies. The fact that anyone used this function, when its usage was so clearly contradicting its name, speaks to a deep level of nobody caring.

    It was, at least, an easy refactoring. But it speaks to how thoroughly broken their codebase is.

    [Advertisement]
    Continuously monitor your servers for configuration changes, and report when there’s configuration drift. Get started with Otter today!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleGitHub Enterprise: The best migration path from AWS CodeCommit
    Next Article Introducing

    Related Posts

    Machine Learning

    Salesforce AI Releases BLIP3-o: A Fully Open-Source Unified Multimodal Model Built with CLIP Embeddings and Flow Matching for Image Understanding and Generation

    May 16, 2025
    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 16, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    ‘World of Warcraft’ is having a quiet renaissance right now, but there’s still a big problem

    News & Updates

    World Agricultural Cycling Competition Targeted in Large-Scale Phishing Scam

    Development

    CVE-2025-29972 – Azure SSRF Spoofing Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Development Release: FreeBSD 13.5 BETA-2

    News & Updates

    Highlights

    Weekly News for Designers

    November 12, 2024

    This week’s designer news includes CSS Printing Guide, Retrofitting Fluid Typography, CSS :has() Interactive Guide,…

    Web Scraping With RSelenium (Chrome Driver) and Rvest

    March 17, 2025

    CVE-2025-3520 – “WordPress Avatar Plugin File Deletion Vulnerability”

    April 21, 2025

    So is FileHippo now a malware site? [closed]

    November 25, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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