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: Catch or Else

    CodeSOD: Catch or Else

    August 5, 2024

    Today’s anonymous submitter asks a question: “How do you imagine the rest of the codebase to be like?”

    Well, let’s look at this snippet of TypeScript and think about it:

    .catch((): void => {
    this.loadFromServerAndShowMessage();
    });
    } else {
    this.loadFromServerAndShowMessage();
    }
    })
    .catch((): void => {
    this.loadFromServerAndShowMessage();
    });
    } else {
    this.loadFromServer();
    }
    }

    From the .catchs, I can tell that we’re looking at a series of nested promises, each loading content based on the results of the previous. The requests may fail in two ways- either through an exception (hence the catch calls), or because it doesn’t return useful data in some fashion (the else clauses).

    Regardless of how it fails, we will loadFromServerAndShowMessage, which implies that we’re not expecting to handle failures based on connectivity. That seems like a mistake- if our promise fails for some reason, it’s likely because we don’t have connectivity, so loadFromServer doesn’t seem like a viable operation. Maybe we should look at the exception?

    Nah, we don’t need to do that.

    How do I imagine the rest of the code base? Well, I imagine it as a messy thicket of dependencies and no real modularity, fragile and confusing, and probably riddled with bugs, many of which are difficult or impossible to replicate in a controlled environment, meaning they’ll likely never get fixed.

    [Advertisement]
    BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleLWiAI Podcast #176 – BIG WEEK! SearchGPT, Lamma 3.1 405B, Mistral Large 2
    Next Article Data Warehouse Solutions Insights: Engineering and Analytics

    Related Posts

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4831 – TOTOLINK HTTP POST Request Handler Buffer Overflow Vulnerability

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4832 – TOTOLINK HTTP POST Request Handler Buffer Overflow Vulnerability

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    OpenAI’s Sam Altman claims AI will “gradually” replace software engineers — Creating an urgent need to master “AI tools”

    News & Updates

    CISA Adds Four Actively Exploited Vulnerabilities to KEV Catalog, Urges Fixes by Feb 25

    Development

    PAN India Townhall “Crafting Tomorrow, Together”

    Development

    Xbox fans are pining for Microsoft to re-open backward compatibility, considering it previously said it would add “as many games as possible” from Activision’s catalog

    News & Updates
    Hostinger

    Highlights

    Machine Learning

    DeltaProduct: An AI Method that Balances Expressivity and Efficiency of the Recurrence Computation, Improving State-Tracking in Linear Recurrent Neural Networks

    April 2, 2025

    The Transformer architecture revolutionised natural language processing with its self-attention mechanism, enabling parallel computation and…

    The Maaaar’s Child: Part 2

    November 29, 2024

    Windows 11 is getting more popular by the month, with almost 30% market share

    July 1, 2024

    Webinar Alert: Learn How ITDR Solutions Stop Sophisticated Identity Attacks

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

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