Up to Main Index                            Up to Journal for August, 2019

                     JOURNAL FOR SUNDAY 11TH AUGUST, 2019

SUBJECT: In whom do you trust? + some updates
   DATE: Sun 11 Aug 21:13:59 BST 2019

I’ve just pushed out some overdue updates to the public dev branch. First of
all are the tests for the current PUT command. Secondly a reimplementation of
the PUT command using the matcher code. This does mean that the test coverage
drops from 100% for the old PUT command down to 83.9% for the new PUT command.
This is due to the new functionality provided by the matcher, which needs
additional tests, which I am working on providing. With the new PUT you can do
things like:

  …and so on.

I’m still not happy with the code. The commands are now rife with minutia and
bookkeeping. In fact my wife commented that I seem to be sneaking off to the
study less to play with my computers — so it must be bad :(

But I have a plan to get back on track!

My plan is to write the tests for the TAKE command, reimplement the TAKE
command to use the matcher, add additional tests for the new functionality. I
will then have five commands that are using the matcher: GET, DROP, PUT, TAKE
and WHICH. These commands are quite a good representation of commands in
general. I should therefore be able to analyse these five commands for
similarities and repetitive code. The aim being to refactor the commands so
that the code is short, simple and easier to work with again. I can then
continue to update the other commands.

A few people called me out on a comment I made in my last post where I said:

  “There are other reasons I’m not happy right now. The new generics
   proposal for Go, the way modules are being pushed. What happened to
   Java seems to be happening all over again.”

Some were worried I might switch to another language and start over again[1].
Others pointed out you don’t have to use the new features just because they
are there.

I’m willing to give Go the benefit of the doubt and see how things pan out.
However, I disagree with the “you don’t have to use the new features” comment.
With the new features added other Go programmers will start using them which
means you will need to start using them in your code if you use their
packages/modules. At a minimum if they start using error wrapping and generics
then you will have to understand how the new feature work — simply to be able
to read other peoples code, understand how it works and work with it.

Then there are Modules. I don’t dislike modules per se. However, modules are
not simply dependency management, they are also distribution. I dislike the
fundamental idea of pulling random code down onto my box[2], implicit trusting
it and using it to build an executable. Getting at the code is not easy as it
can be pulled automatically and is then hidden away in the build cache
somewhere. Do you have to use modules? No, but if a project is using modules
you want to use you may not have a choice. I have seen a lot of examples of
“bad things” being distributed via repositories: docker images, ruby gems,
python packages (pip)”. Some people might say “ah, but the module mirrors and
proxies have a checksum database!” which indeed they do. However that does not
prevent bad code from being released and getting a good checksum…

I’m probably overly paranoid and overthinking all of this — I usually do. I do
think that not enough people take the time and trouble to read source code :P


  [1] If I was to stop using Go I have no idea what language I would switch
      to. I have no plans to switch away and haven’t even thought about it.

  [2] The irony of running Debian Linux with Apt/Aptitude and pulling packages
      for updates is not lost on me. However I do a lot of checking, watch
      development, read patches, download and read source code and have a
      trashable VM I use before updating any ‘real’ machines. A lot of the
      code I run is also written by myself - whom I trust, everything else I
      validate ;)

  Up to Main Index                            Up to Journal for August, 2019