Join us

Racism, Autism, Clean Code and Safe Office Spaces

In my old life, I had to deal with questions such as, “how do I motivate Mary so that she comes in on time and does her work diligently?”

In my new life, I have questions such as, “how do I ensure that the correct metadata is automatically published for a newly available ultra high definition (UHD) tv programme promptly so that the i-player website is always correct?”

Seven simple steps to solve my current issues:

  • Know a bit of python
  • Use Test Driven Development (TDD) to write a unit test.
  • Use Unittest module patch instead of dependency injection for mock.
  • Update code until code passes.
  • Use AWS cloudformation to deploy infrastructure as code to implement
  • Examine cloudformation JSON and manipulate python classes and loops to write appropriate JSON
  • Smoke test the result

Learn Python

https://learnxinyminutes.com/docs/python/


Let me tell you a secret, writing computer programs; coding is easy. I’ve spent most of my life in business as a finance professional and finance systems consultant, which was hard. It was almost impossible. All day every day, I had to deal with other people. I had to read their minds to find out what makes them happy and then give that to them. I had to make small talk, network and build working relationships. I had to decide on who to hire and who should be fired. I had to be empathetic, thoughtful, polite, friendly and motivated.

However, I could not mind reading. I was often stereotyped as the black working class trouble maker — the foreigner, separate and different, temporary and future enemy. I was tolerated as I could see what they couldn’t see. I saw blindingly obvious solutions that saved companies millions of pounds. I saved EasyJet millions of pounds simply by reading and understanding the published VAT rules, something anyone could have done. I then applied them as stated by using simple maths and percentages. This enabled them to calculate their correct VAT liability instead of overpaying.


Test Driven Development

Decide what you want the code to do. Then write a test in code that passes when the code does what it suppose to do. Update the code until the test passes. No magic or mind-reading is needed. This is Test Driven Development (TDD)

As Kent Beck says, “TDD is meant to eliminate fear in application development. The byproducts of fear include tentative, grumpy, and uncommunicative programmers who cannot absorb constructive criticism. When programming teams buy into TDD, they immediately see positive results. They eliminate the fear involved in their jobs.”

TDD Hello world example

Write failing code — decide on code design

Write a test — test design

See test fail — ensure design tested.

Write passing code — implement design

See test pass — check that design implementation works.


Mock Objects in unittest with patch function

unittest.mock() has a mechanism for mocking objects using patch(), which looks up the object to be mocked in a given module and replaces that object with a mock.

A mock or mock object substitutes and imitates a real object in a test to control the behaviour of the tested code.

Notice that it is crucial where you ‘patch’. You need to ‘patch’ where you look up the object.

Using patch a decorator — the code to be tested

Using patch in test to replace requests object


Using Python AWS SNS library in Code

Amazon Web Services (AWS) is a cloud service many companies use to host online services.

As well as hosting applications on servers, AWS also provides other services such as S3, Simple Storage Service and SNS, Simple Notification Service. SNS is a messaging service that implements the pub-sub pattern.

UHD metadata code uses this messaging service to trigger an update of i-player when new UHD media is available.

Example of python using boto3 library for SNS — publish a message to topic


AWS Cloudformation — Infrastructure as Code

Infrastructure is the services and resources you need to deploy and run your code.

You could set these up by using the AWS console, filling in the forms etc.

However, you can use code to set up your AWS infrastructure.

This code is a template written in either JSON or YAML.

This is referred to as cloudformation. Having it as code makes it repeatable and allows it to be version controlled.

Example of AWS cloudformation for EC2 — Server, elastic cloud computer


Using a Python Library — Troposphere to Create Cloudformation JSON

The cloudformation JSON can be written by hand, but it is easier and clearer to use code to output the JSON.

The troposphere python library is used to create AWS cloudformation.

All that is needed is an understanding of python, for example, instantiating classes and setting class and instance variables.

Create an EC2 instance.

Alternatively, parameters can be used instead of properties.


My management style; way of dealing with people was different. So for Mary, it was first about recruiting the best person. So I favoured actual metrics above team fit and personality. An easy primary metric is turning up for the interview on time when given ambiguous incomplete information. An excellent excuse for being late did not cut it for me.

Secondly, I always judged my team on what they did rather than what they said they wanted to do — so arriving for work at an agreed time, even if late, rather than occasionally missing the contractual start time.

I was never big on motivation. I just had a down-to-earth chat with my staff about what they wanted from work. I made some suggestions but held them to what they wanted in the main. So if they wanted a promotion, I expected them to over-deliver. In contrast, if they wanted a quiet life, I was happy for them to do the minimum work but contribute to the team’s success in other ways, such as remembering birthdays.

Yet, it wasn’t easy. I always masked my neurodiversity. This took its toll on me mentally and emotionally. Also, racism was always present as a background hum or negativity. There was always racist talk and stereotyping when I was not present. I know this because concerned colleagues ‘helpfully’ told me about it. It was tough.

In contrast, the UHD metadata issue for the i-player tv programmes task was straightforward.


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

Avatar

Errol Elliott

Senior Software Engineer, BBC

@ezzye
Ezzy Elliott(ezzy.elliott@gmail.com) BBC and https://t.co/eJ1pNWeDI7. Passionate about justice, coding, autism & Hackney. The views expressed are my own.
User Popularity
14

Influence

1k

Total Hits

1

Posts