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»Representative Line: Null Ability

    Representative Line: Null Ability

    August 29, 2024

    The addition of nullable or optional types to mainstream languages was a net good. It doesn’t completely solve the billion dollar mistake, but it makes it far easier to write safe code.

    For most of us anyway.

    Sam found this representative line, which shows how one of his peers understand nullable types to work:

    DateTime? current = new DateTime?();

    I actually don’t think I’ve ever seen anyone create an instance of the nullable wrapper directly, like this. I’ve never contemplated doing it. The more traditional usage would be something like:

    DateTime? current = someFunctionWhichMayReturnAValueOrNull();

    We don’t know if we got a null or not, but because it’s wrapped in a nullable type, we can still handle it safely without risking a null reference exception.

    Instantiating a nullable type directly results in a nullable type that is known to be empty. Which I can imagine some uses for, I suppose, but still seems like a real weird choice. And it’s unclear- if you really wanted that, you’d just do DateTime? current = null; which is a more obvious way to say the same thing.

    In the end, I’m not certain this is actually a WTF, but it still perplexes me. And it’s a representative line- this pattern appears everywhere in Sam’s codebase, with enough frequency that it’s more of a surprise when people use nullables the standard way.

    [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 ArticleRecommending for Long-Term Member Satisfaction at Netflix
    Next Article Case Study: Armur—Alexandra Murgu Portfolio

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

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

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Build a financial research assistant using Amazon Q Business and Amazon QuickSight for generative AI–powered insights

    Machine Learning

    JMeter plugin so that we are able to see run time error when we are doing executions

    Development

    Perficient Insights: Dreamforce 2024 with Jonathan Rademacher

    Development

    Razer Cortex is Closing Discord: 3 Ways to Stop it

    Operating Systems

    Highlights

    EasyNAS – Linux distribution designed for storage management

    April 9, 2025

    EasyNAS is a storage management system for home or small office. It uses openSUSE with…

    Universal Design in Pharmacies – Digital Accessibility

    February 6, 2025

    Quantum Framework (QFw): A Flexible Framework for Hybrid HPC and Quantum Computing

    August 20, 2024

    CVE-2025-43565 – ColdFusion Incorrect Authorization Arbitrary Code Execution

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

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