Thoughts on Alexa Skills

My employer is having a Hackathon and the team I am on is investigating Alexa skills.

The plan was to use the email address of the Alexa account to match against the email address of the customer we already have. It took us all a little while to get a hello world Alexa app stood up. Alexa has been around long enough that there are now more wrong setup articles than good ones.

The Amazon documentation is lacking in actual code samples alongside the documentation.

It does have a full setup including it’s own github build pipeline and deployment tools. The downside is that this makes it more difficult to integrate with your own build tools. For example it wants you to push.to master on it’s repo, yet ours has that name restricted, so we need to branch again to push it to github.

The debugging experience is painful. The default logging system is very weak. A simple list of log events that is hard to search.

The simulator is missing key features. You can’t trigger permission requests and there is no way to bypass these. You need permissions to fetch a basic email address, and getting this involves an interesting dance with various other services.

Let’s see if this gets better on Day 2.

Why Loki does not break the Time Travel Rules of Endgame

Professor Hulk gave a long talk on the rules of time travel in Endgame. These were based upon his logical reasoning. It is possible that those limits were enforced by the method of Time Travel used: move to parallel universes and you are not going to have consequences on your own.

However Loki using TVA gateways did manage to move backwards on the single timeline and have a conversation that altered the future.

I suspect that The Hulk only had logical reasoning to define the rules, where as Loki found out by experience.

Classic Elixir Bug

Data in Elixir is immutable. This can lead to some subtle bugs.

Here is the example Ecto.Multi sample

defmodule PasswordManager do
  alias Ecto.Multi

  def reset(account, params) do
    Multi.new()
    |> Multi.update(:account, Account.password_reset_changeset(account, params))
    |> Multi.insert(:log, Log.password_reset_changeset(account, params))
    |> Multi.delete_all(:sessions, Ecto.assoc(account, :sessions))
  end
end

This could be rewritten as

defmodule PasswordManager do
  alias Ecto.Multi

  def reset(account, params) do
    multi = Multi.new()
    multi = Multi.update(multi, :account, Account.password_reset_changeset(account, params))
    multi = Multi.insert(multi, :log, Log.password_reset_changeset(account, params))
    multi = Multi.delete_all(:sessions, Ecto.assoc(account, :sessions))
  end
end

Forget to capture the multi at any step and you will lose the specific change from the batch.

This is insidious when moving from the first to the second to add a calculated value or when the function you are adapting only uses one multi

Wheel of Time season 2

After watching season 1 of wheel of time I started reading the books. Currently I am on book 13 of 14. This article is trying to be spolier free.

The TV adaption was always going to differ from the books. We are not going to get 14 seasons with all of the characters

Season 1 did a good job of introducing the world, and managed to introduce some characters earlier than we would otherwise have met them.

Starting the characters off a little older than the books returns to the authors intent, before being asked by his publisher to make them younger.

Critical numbers have been reduced and there are 8 Forsaken and it only takes 8 to still someone – these required 13 in the books.

There is a slight flaw in timing in the new episodes. Perrin is with a group tracking Pendan Fain from the end of the previous season yet the group in the White Tower seem to have been there longer. This could just be a syncronisation issue with his letter being written and received some time later.

Several of the characters are in different places to the book. Rand and Matt need to be with Perrin. Matt could join the girls on their trip to the coast later on. Not sure how Rand will make the journey.

An interesting note on the opening catchup – all characters that were focussed on will be important later on.

Security > Usabilty

Recently there have been a number of changes to systems in the name of Security.

Security is a good thing, but so is being able to use a system.
A system is perfectly secure if no-one can use it. However it scores zero on the usability scales.

Consider a useful balance.

For example some systems insist on emailing a code to confirm logins. This can be useful.
The login link expires after a finite time, also a good idea.

When the link expires before the email is delivered or is invalidated when the next is requested will lead to loops where it is not possible to access a system.

Storybook is Amazing

I have recently added Storybook to one of the UIs that I am working on.

Storybook is an envitonment for providing a place to display UI components in a catalog. Typically this is used for development of a component library.

It is also useful slightly higher up the stack. Having entire forms or parts of forms testable in isolation is a big win. This allows you to show a form in all its possible states, even if some of them would require exotic conditions.

This can greatly free up development time while ensuring that the component can be refactored.

Having the components testable in isolation makes testing cross browser much easier. You can stand up Storybook locally without any backend services.

Given that I mostly work on an application with a React frontend with a GraphQL backend this reduces the effort on isolating changes to the frontend. So far I have not managed to use the fake GraphQL services, but by splitting the components into GraphQL layers and a pure function allows the pure function to be tested.

Magic The Gathering

I am just getting back into this game.
The last time I had played was 1997 so the modern game is very different.

The new restricted formats are an interesting twist.

Pauper – 60 or more cards, only if they have ever been common.

Commander – 1 Commander and 99 cards. No duplicated cards except for basic lands. There are a few exclusions.

The mana burn rule has been removed so you don’t need to have sinks for using up all of the spare mana you have floating around.

Mulligans help avoid the no land/all land hands.

The second step of the Mtg Online tutorial opponent could have been using my first Pauper deck, with Raging Goblins and Goblin Grenade!

I started to build my own commander decks from my collection. Only when checking the counts of the cards I found that the following two were banned:

  • Balance
  • Limited Resources

    I can see how devastating Limited Resources could be in multiplayer commander! Only having 10 lands across all of the players could mess up most decks.

Eyre’s First Law

If a utility is useful for testing it will eventually make its way into production.

I have seen this pattern many times.

You add a piece of code (possibly to help set up a test) that sets some state.
This then gets extracted from the test to a shared library.
It then gets added to the backoffice tool for development purposes.
This is then required for production.