• mambo (unregistered) in reply to Matt R

    "Or gasp you could use a comment! Then you can remove the assumption that the moron who will be reading/maintaining your code will see the "obvious".

    final long ms = 300000; /* 5 minutes worth of milliseconds */"

    Now try adding 1 minute to that and to

    "final long ms = 5 * 60 * 1000;"

    This isn't about some idiots not able to calculate one minute in milliseconds, this is about clearness and simpleness. After changing this value a few times I'd probably write "final long ms = (5 * 60 * 1000)+(0*1000);" so you can easily add seconds ^^

    Second point is if you have to comment that line you'd simply write /(minutes)+(seconds)/ and never change that again. If someone ever fiddles with the value and changes 300000 to something else forgetting to change the comment as well you could end up with a hard to spot bug....

  • Christian (unregistered) in reply to Matt R

    But, it takes longer to write a comment than to simply make the code make sense.

  • coddy (unregistered)

    It must have something to do with ASCII: patno -= 'Y'//(ASCII CODE 89) //Y? WHY? WHY!?!?!

  • NelsonD (unregistered) in reply to Matt R

    or even better

    final long ms = 5 * 60 * 1000; /* 5 minutes worth of milliseconds */

  • Squirrel (unregistered) in reply to Matt R

    Because magic numbers and comments never become out of sync over time.

  • enpien (unregistered)

    magnesium et cialis walmart pharmacy cialis

  • enpien (unregistered)

    stromectol rxlist stromectol buy now

  • enpien (unregistered)

    coke et cialis cialis daily generic

Leave a comment on “A Dubious Honor”

Log In or post as a guest

Replying to comment #:

« Return to Article