• 4 Posts
  • 187 Comments
Joined 1 year ago
cake
Cake day: June 11th, 2023

help-circle
  • Because I stumbled over this paragraph (the page is linked to from Googles announcement) and was reminded of this comment, I’ll quote it here:

    First, developer education is insufficient to reduce defect rates in this context. Intuition tells us that to avoid introducing a defect, developers need to practice constant vigilance and awareness of subtle secure-coding guidelines. In many cases, this requires reasoning about complex assumptions and preconditions, often in relation to other, conceptually faraway code in a large, complex codebase. When a program contains hundreds or thousands of coding patterns that could harbor a potential defect, it is difficult to get this right every single time. Even experienced developers who thoroughly understand these classes of defects and their technical underpinnings sometimes make a mistake and accidentally introduce a vulnerability.

    I think it’s a fair and correct assessment.



  • Read/Inspect and contribute to FOSS. They’ll be bigger and longer lived than small, personal, and experimental projects.

    Study computer science.

    Work, preferably in an environment with mentors, and long-/continuously-maintained projects.

    Look at alternative approaches and ecosystems. Like .NET (very good docs and guidance), a functional programming language, Rust, or Web.

    That being said, you ask about “should”, but I think if it’s useful for personal utilities that’s good enough as well. Depends on your interest, goals, wants, and where you want to go in the future.


    For me, managing my clan servers and website, reading online, and contributing to FOSS were my biggest contributors to learning and expertise.





  • Formatted, so I can read it

    Exception in thread "main" java.lang.NullPointerException: 
     Cannot invoke "String.toLowerCase()" because the return value of 
    "com.baeldung.java14.npe.HelpfulNullPointerException$PersonalDetails.getEmailAddress()" is null
     at com.baeldung.java14.npe.HelpfulNullPointerException.main(HelpfulNullPointerException.java:10)
    



  • If you only care about contributing improvements, no, it doesn’t matter.

    If you want to at least be recognized as an author, and be able to say “I made this”, the license opposes that.

    Waiver of Rights: You waive any rights to claim authorship of the contributions […]

    I don’t know how they intend to accept contributions though. I guess code blocks in tickets or patch files? Forking is not allowed, so the typical fork + branch + create a pull request does not work.


  • I’ve been using TortoiseGit since the beginning, and it covers everything I need. Including advanced use cases. I can access almost all functionality from the log view, which is very nice.

    I’ve tried a few other GUIs, but they were never able to reach parity to that for me. As you say, most offer only a subset of functionalities. Most of the time I even found the main advantage of GUIs in general, a visual log, inferior to TortoiseGit.

    GitButler looks interesting for its new set of functionalities, new approaches. Unfortunately, it doesn’t integrate well on Windows yet. Asking for my key password on every fetch and push is not an acceptable workflow to me.









  • Using early returns and ternary conditional operator changes

    private boolean meetsRiderPreferences(Rider rider, Driver driver) {
        if (driver.rating >= 4.5) {
            if (rider.preferences.includes('Premium Driver')) {
                  return driver.isPremiumDriver;
            } else {
                  return true;
            }
        } else if (driver.rating >= 4.0) {
            return true;
        } else {
            return false;
        }
    }
    

    to

    private boolean meetsRiderPreferences(Rider rider, Driver driver) {
        if (driver.rating < 4.0) return false;
        if (driver.rating < 4.5) return true;
    
        return rider.preferences.includes('Premium Driver') ? driver.isPremiumDriver : true;
    }
    

    dunno if java has them, but in C# switch expressions could put more of a case focus on the cases

    private boolean meetsRiderPreferences(Rider rider, Driver driver) {
        return driver.rating switch {
            < 4.0 => false,
            < 4.5 => true,
            _      => rider.preferences.includes('Premium Driver') ? driver.isPremiumDriver : true,
        };
    }
    

    or with a body expression

    private boolean meetsRiderPreferences(Rider rider, Driver driver) => driver.rating switch {
        < 4.0 => false,
        < 4.5 => true,
        _      => rider.preferences.includes('Premium Driver') ? driver.isPremiumDriver : true,
    };
    

    The conditional has a true result so it can be converted to a simple bool condition as well.

    private boolean meetsRiderPreferences(Rider rider, Driver driver) => driver.rating switch {
        < 4.0 => false,
        < 4.5 => true,
        _      => !rider.preferences.includes('Premium Driver') || driver.isPremiumDriver,
    };