My work experience at Potato: William

Potato
@potato
Published in
5 min readSep 10, 2019

William is a final year GCSE student at Charterhouse School. He spent 2 weeks at Potato learning Python and working on some of our internal tools…

William and his Potato buddies

What attracted you to doing work experience at Potato?

Potato has worked with Google, Mozilla and many other companies. Their developers are experienced in almost every field of computer science — app development, websites, and even augmented reality. My dad told me about Potato after he met an employee in the gym. My dad forwarded my CV and I was then emailed by someone in HR. Working at Potato has allowed me to gain industry experience and knowledge and experience technologies I wouldn’t normally use; such as Django, Flask and TypeScript.

What have you been up to over the last 2 weeks?

Bytes is an internal website used to order food. Every morning, you go to the order form, choose as many items as you like from four menus and your order is then used to buy and collect food from the vendors. If a user added a note to an item, the note would stay visible for up to five seconds and then disappear. In order to make the note reappear, the user would have to add another item to the order and wait a few seconds for the backend to be polled. In the admin view, our studio co-ordinator who arranges food deliveries wouldn’t be able to see the note either, unless they’d ordered a second item. Very few people at Potato know this is a workaround — I only stumbled upon it by mistake after I was investigating the requests made by my browser in an attempt to find the cause. As this solution is far from ideal, I asked for access to the source code so that I could try to fix the cause of the problem.

Bytes is a Django app running on Google AppEngine (using Potato’s Djangae modification). In order to create an API, you add a url to the router, write a serializer for the model so Django knows what data to show and edit, and create a view for the API (which is four lines of code).

We use the filter_fields in order to select the order items for each diner from the queryset. Let’s look at our Order and OrderItem classes.

Nothing looks out of the ordinary here. However, we know that adding an item reveals the notes, so let’s look at the add_item method.

When we update an item’s note, we know the change is recorded on the client and successfully sent to the server via the REST API as seen in the screenshot below:

Django’s doing its job. So what’s the problem? If we compare the code between the save and add_item methods, there’s one subtle difference. The latter updates itself and deletes itself from memcache. Let’s add that to our code.

And now it works!

I also fixed other bugs to do with nth-child borders and teams missing from the internal scheduling tool. Whilst working on the scheduling tool and also a web app which integrates which Spotify, I used TypeScript, an open-source superset of JavaScript.

TypeScript is definitely a step forward in the right direction. However, I don’t like its Kotlin-esque variable and parameter declaration. I decided to fork TypeScript and swap the parameter and name back to the Java and C style (the relevant lines can be found here). However, a superset is supposed to be able to run the subset without any problems. Instead, I decided to write a parser which is basically a complicated regex search and replace, with support for comments, strings, classes, interfaces, generic types, arrays and TypeScript getters and setters.

Unfortunately, JavaScript doesn’t require semi-colons and variables and methods can be defined anywhere. As a result, you can’t just search for methods, count the brackets, and substring when the number of brackets is 0.

Furthermore, A variable declaration in Java is just two identifiers. return this would be identified as a variable declaration by a regex. To counter this, reserved words in JavaScript and TypeScript are stored in an array, and then when matching variables, we can just check to see if the type is in the array.

Strings are also replaced with an equal length string of \u0001 to prevent a string containing “void x()” being converted into “function x(): any”. When the compiler replaces a string with another string, we amend the stored strings and their indices to account for that change. Therefore when we finish processing the file, all we need to do is just replace the equal length strings of \u0001 with the original string. Comments are also stripped from the files.

What has surprised you about working at Potato?

The environment at Potato is very relaxed; no one is in a suit. During the work day, you can walk over to your buddies and ask them a question or play a game of pool. Moreover, some of the developers work from bean bags near the pool table and meeting room during the afternoons. Food is also free and picked up by some of the Potatoes every afternoon. You can eat at your desk whilst working or with the rest of the Potatoes at the lunch table.

What is your biggest learning from your work experience here?

I was very interested to see how the teams collaborate. Every morning, there’s “stand up”. Everyone in the team stands up and discusses what they did yesterday, what they’re going to do today and if they have any blockers (problems they’re stuck on). Three times a week, a Potato from Germany video calls his team in London so that he can participate in stand up. Furthermore, the developers will often ask each other if they’re stuck on a problem.

What’s your best tip for future work experience students coming to Potato?

Don’t feel afraid to ask someone something. Whether it’s about programming, university/career, or general advice. Everyone is friendly and understanding and will direct you to someone else if they don’t know the answer. You have nothing to lose.

Thanks William, it was great to have you here and thanks for fixing our lunch app!

--

--

Potato
@potato
Editor for

We're a digital product specialist for businesses that demand quality at speed. We believe that quality is the fastest path to success. AKQA Group (WPP )