Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Insider News
  4. Top 10 useful, yet paranoid Java programming techniques

Top 10 useful, yet paranoid Java programming techniques

Scheduled Pinned Locked Moved The Insider News
javahtmlcomquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kent Sharkey
    wrote on last edited by
    #1

    Jaxenter[^]:

    Lukas Eder shares his personal tips and habits after more than 20 years of programming, which he groups under the banner of “defensive programming”. Surely he’s not the only one who gets paranoid now and then?

    "Trust everybody, but always cut the cards"

    Y 1 Reply Last reply
    0
    • K Kent Sharkey

      Jaxenter[^]:

      Lukas Eder shares his personal tips and habits after more than 20 years of programming, which he groups under the banner of “defensive programming”. Surely he’s not the only one who gets paranoid now and then?

      "Trust everybody, but always cut the cards"

      Y Offline
      Y Offline
      Yuriy Loginov
      wrote on last edited by
      #2

      // Bad
      if (variable.equals("literal")) { ... }

      // Good
      if ("literal".equals(variable)) { ... }

      IMO code like this hides real bugs, I'd much rather get a null exception and figure out why the variable is NULL instead of been fooled into thinking evreything is working because it didn't crash.

      W 1 Reply Last reply
      0
      • Y Yuriy Loginov

        // Bad
        if (variable.equals("literal")) { ... }

        // Good
        if ("literal".equals(variable)) { ... }

        IMO code like this hides real bugs, I'd much rather get a null exception and figure out why the variable is NULL instead of been fooled into thinking evreything is working because it didn't crash.

        W Offline
        W Offline
        Weylyn Cadwell
        wrote on last edited by
        #3

        ... You can do that?! Why is that even a thing?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups