Become a better programmer in 30 minutes

Programmers nowadays should all know these 3 very important rules:

  1. Don’t use floating points for money
  2. Store date/time in “UTC” timezone
  3. Always use the “UTF8” character set

Tom Scott brilliantly explains the above 3 topics in videos that roughly last 10 minutes each. He explains them clearly, with depth and in a passionate way. They are listed below. Start the video’s by clicking on them.

1. Don’t use floating points for money

…never ever…

utf8_video

2. Store date/time in “UTC” timezone

…yes, always…

timezone_video

3. Always use the “UTF8” character set

…no exceptions…

floating_points_video

IMHO every programmer should watch these videos, because they are very educational. And “Yes”, it will takes you 30 valuable minutes of your precious time. But “No”, you will not regret it, because they teach you some valuable and elementary lessons. Lessons that apply on any software project, written in any programming language.

Thank you Tom Scott, you rock! Keep doing videos on your YouTube channel!

Share

6 thoughts on “Become a better programmer in 30 minutes”

  1. This is all good advice, but as someone who cut their programming teeth (so to speak) on FORTRAN back in the early 1980s, can I just say that #1 was drummed into us as soon as we learned about integer and floating point variables.

    Also, we were taught that most non-integral floating-point values (e.g. 3.1) cannot be stored exactly, so if you read a value such as 3.1 from a data file into a floating-point variable and then print it out, don’t be surprised if you see something like 3.09999998.

  2. @David: Thank you for your comment and the confirmation. I programmed some assembly language (interrupt vectors) in the early 90’s so I can relate a little. For me all these three rules are pretty obvious. To respond to your remark: I guess when floating points were new, people were much more concerned about wrong usage. Nowadays there are programming languages, like PHP, in which integer-to-float conversion goes implicit. I’m sure that does not help to understand what is going on “under the hood”.

  3. @Roger: Well said! Comparing floats seems pointless… 😉

  4. @Roger: s/floating point number/programming language that doesn’t give you complete control over how your numbers will be stored/

    😉

  5. @Maurits: “Comparing floats seems pointless”

    One of the lessons we learned in FORTRAN programming back in the 1980s was never to compare two floating point numbers for equality, since it will almost never be true, due to rounding errors and inexact representation of decimal numbers.

    However, it is perfectly okay to test whether one floating-point number is larger than another, or to test whether the absolute value of the difference between two floating-point numbers is smaller than some limit. Thus, in FORTRAN, never write

    IF (A.EQ.B) …

    but this is okay:

    IF (ABS(A-B).LT.1D-10) …

    and is the correct way to check whether two numbers are equal to within some small limit.

Leave a Reply

Your email address will not be published. Required fields are marked *