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

      UX Job Interview Helpers

      August 5, 2025

      .NET Aspire’s CLI reaches general availability in 9.4 release

      August 5, 2025

      15 Essential Skills to Look for When Hiring Node.js Developers for Enterprise Projects (2025-2026)

      August 4, 2025

      African training program creates developers with cloud-native skills

      August 4, 2025

      Why I’ll keep the Samsung Z Fold 7 over the Pixel 10 Pro Fold – especially if these rumors are true

      August 5, 2025

      You may soon get Starlink internet for a much lower ‘Community’ price – here’s how

      August 5, 2025

      uBlock Origin Lite has finally arrived for Safari – with one important caveat

      August 5, 2025

      Perplexity says Cloudflare’s accusations of ‘stealth’ AI scraping are based on embarrassing errors

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

      Send Notifications in Laravel with Firebase Cloud Messaging and Notifire

      August 5, 2025
      Recent

      Send Notifications in Laravel with Firebase Cloud Messaging and Notifire

      August 5, 2025

      Simplified Batch Job Creation with Laravel’s Enhanced Artisan Command

      August 5, 2025

      Send Notifications in Laravel with Firebase Cloud Messaging and Notifire

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

      This comfy mesh office chair I’ve been testing costs less than $400 — but there’s a worthy alternative that’s far more affordable

      August 5, 2025
      Recent

      This comfy mesh office chair I’ve been testing costs less than $400 — but there’s a worthy alternative that’s far more affordable

      August 5, 2025

      How to get started with Markdown in the Notepad app for Windows 11

      August 5, 2025

      Microsoft Account Lockout: LibreOffice Developer’s Week-Long Nightmare Raises Concerns

      August 5, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Objectifying Yourself

    CodeSOD: Objectifying Yourself

    April 28, 2025

    “Boy, stringly typed data is hard to work with. I wish there were some easier way to work with it!”

    This, presumably, is what Gary‘s predecessor said. Followed by, “Wait, I have an idea!”

    public static Object createValue(String string) {
    	Object value = parseBoolean(string);
    	if (value != null) {
    		return value;
    	}
    
    	value = parseInteger(string);
    	if (value != null) {
    		return value;
    	}
    
    	value = parseDouble(string);
    	if (value != null) {
    		return value;
    	}
    
    	return string;
    }
    

    This takes a string, and then tries to parse it, first into a boolean, failing that into an integer, and failing that into a double. Otherwise, it returns the original string.

    And it returns an object, which means you still get to guess what’s in there even after this. You just get to guess what it returned, and hope you cast it to the correct type. Which means this almost certainly is called like this:

    boolean myBoolField = (Boolean)createValue(someStringContainingABool);
    

    Which makes the whole thing useless, which is fun.

    Gary found this code in a “long since abandoned” project, and I can’t imagine why it ended up getting abandoned.

    [Advertisement]
    Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleDual Booting CachyOS and Windows
    Next Article CVE-2025-4006 – Youyiio BeyongCms Unrestricted File Upload Vulnerability

    Related Posts

    News & Updates

    Why I’ll keep the Samsung Z Fold 7 over the Pixel 10 Pro Fold – especially if these rumors are true

    August 5, 2025
    News & Updates

    You may soon get Starlink internet for a much lower ‘Community’ price – here’s how

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

    Microsoft confirms Windows 11 KB5060829 issues, but you can safely ignore it

    Operating Systems

    Added to Xbox This Week: College Football, Tony Hawk, Missile Command & More

    Operating Systems

    CVE-2025-4504 – SourceCodester Online College Library System SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Software architecture IS Conway’s Law

    Learning Resources

    Highlights

    CVE-2025-53382 – Apache HTTP Server Cross-Site Request Forgery

    June 28, 2025

    CVE ID : CVE-2025-53382

    Published : June 28, 2025, 3:15 a.m. | 3 hours, 8 minutes ago

    Description : Rejected reason: Not used

    Severity: 0.0 | NA

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    How to Build a Word Search Game Using HTML, CSS, and JavaScript

    July 14, 2025

    CVE-2023-47032 – NCR Terminal Handler Remote Code Execution Vulnerability

    June 23, 2025

    CVE-2025-53365 – Apache MCP Python SDK Denial of Service

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

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