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

      Designing With AI, Not Around It: Practical Advanced Techniques For Product Design Use Cases

      August 11, 2025

      Why Companies Are Investing in AI-Powered React.js Development Services in 2025

      August 11, 2025

      The coming AI smartphone: Redefining personal tech

      August 11, 2025

      Modern React animation libraries: Real examples for engaging UIs

      August 11, 2025

      How Debian 13’s little improvements add up to the distro’s surprisingly big leap forward

      August 11, 2025

      Why xAI is giving you ‘limited’ free access to Grok 4

      August 11, 2025

      How Apple may revamp Siri to a voice assistant I’d actually use (and ditch Gemini for)

      August 11, 2025

      I jump-started a bus from the 1930s with this power bank – here’s the verdict

      August 11, 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

      Laravel’s UsePolicy Attribute: Explicit Authorization Control

      August 11, 2025
      Recent

      Laravel’s UsePolicy Attribute: Explicit Authorization Control

      August 11, 2025

      The Laravel Way to Build AI Agents That Actually Work

      August 11, 2025

      The Laravel Way to Build AI Agents That Actually Work

      August 11, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft sued over killing support for Windows 10

      August 11, 2025
      Recent

      Microsoft sued over killing support for Windows 10

      August 11, 2025

      Grok 4 rolled out for free-tier users worldwide, with some limits

      August 11, 2025

      Firefox AI slammed for hogging CPU and draining battery

      August 11, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Would a Function by Any Other Name Still be WTF?

    CodeSOD: Would a Function by Any Other Name Still be WTF?

    May 12, 2025

    “Don’t use exception handling for normal flow control,” is generally good advice. But Andy‘s lead had a PhD in computer science, and with that kind of education, wasn’t about to let good advice or best practices tell them what to do. That’s why, when they needed to validate inputs, they wrote code C# like this:

    
        public static bool IsDecimal(string theValue)
        {
            try
            {
                Convert.ToDouble(theValue);
                return true;
            }
            catch
            {
                return false;
            }
        } 
    

    They attempt to convert, and if they succeed, great, return true. If they fail, an exception gets caught, and they return false. What could be simpler?

    Well, using the built in TryParse function would be simpler. Despite its name, actually avoids throwing an exception, even internally, because exceptions are expensive in .NET. And it is already implemented, so you don’t have to do this.

    Also, Decimal is a type in C#- a 16-byte floating point value. Now, I know they didn’t actually mean Decimal, just “a value with 0 or more digits behind the decimal point”, but pedantry is the root of clarity, and the naming convention makes this bad code unclear about its intent and purpose. Per the docs there are Single and Double values which can’t be represented as Decimal and trigger an OverflowException. And conversely, Decimal loses precision if converted to Double. This means a value that would be represented as Decimal might not pass this function, and a value that can’t be represented as Decimal might, and none of this actually matters but the name of the function is bad.

    [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 ArticleCVE-2025-4553 – PHPGurukul Apartment Visitors Management System SQL Injection
    Next Article Vine Linux is a Linux distribution with an integrated Japanese environment

    Related Posts

    News & Updates

    How Debian 13’s little improvements add up to the distro’s surprisingly big leap forward

    August 11, 2025
    News & Updates

    Why xAI is giving you ‘limited’ free access to Grok 4

    August 11, 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

    CVE-2025-50708 – Perplexity AI GPT-4 Information Disclosure

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-47939 – TYPO3 File Upload Vulnerability (Unrestricted File Type Upload)

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-31261 – Apple macOS User Data Access Permissions Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    How to Use the SHAP-IQ Package to Uncover and Visualize Feature Interactions in Machine Learning Models Using Shapley Interaction Indices (SII)

    Machine Learning

    Highlights

    A Code Implementation to Use Ollama through Google Colab and Building a Local RAG Pipeline on Using DeepSeek-R1 1.5B through Ollama, LangChain, FAISS, and ChromaDB for Q&A Machine Learning

    A Code Implementation to Use Ollama through Google Colab and Building a Local RAG Pipeline on Using DeepSeek-R1 1.5B through Ollama, LangChain, FAISS, and ChromaDB for Q&A

    April 8, 2025

    In this tutorial, we’ll build a fully functional Retrieval-Augmented Generation (RAG) pipeline using open-source tools…

    CVE-2025-54026 – QuanticaLabs GymBase Theme Classes SQL Injection

    July 16, 2025

    GitHub Universe 2025: Here’s what’s in store at this year’s developer wonderland

    May 30, 2025

    Data Center Setup Cost for Startups in India | Affordable Implementation Services

    May 5, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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