I won a place on the JavaScript Workshop with Kyle Simpson (Getify) at trivago

I was very fortunate to win a place to attend the Kyle Simpson JavaScript workshop in the new trivago offices in Dusseldorf thanks to my small contribution the webpack docs. It really was an amazing week and not just did I learn so much but I got to explore the incredible offices as well as hang out with some amazing people.

On Monday we started off with some JavaScript Foundations going over scope and what is known as hoisting. Loved how Kyle turned something that is normally so confusing into red, blue and green marbles and buckets. If you know what color your marbles are then you know what bucket they are in therefore you really can understand scope. And he proved this to us by making us find a partner and teach it to them. So literally we were saying to each other:

Hey scope of baz in the green bucket I have a lhs reference for baz have you heard of him. No — go fish.

What he thought us is that if we can understand how the JavaScript engine works then we really can understand what is going on. We then moved on to functional and block scoping, the importance of naming functions, closure and modules. And after 10 pages of notes I think I really had taken in a lot.

After a very enjoyable but tiring day I get to explore the offices. I really was unsure of where to start, the ground floor and go up or start at the top. I just randomly chose a floor thinking that it would only take a few minutes but an hour later and I was still on the same floor. I Walked around the offices and stopped at every meeting room to take photos. They were just amazing. A lego room where you just get to build things out of lego for those moments when your feeling blocked. A room with a tent, a room with a hammock, a room with sun loungers…. and many more for those moments you just want to relax.

There were rooms like an enchanted forest, a yoga room, a room with elks coming out of the walls or life size knights in shining armour. It was so impressive and I felt like I was in a museum. I then decided to skip a few floors and went to pay a visit to the roof which is a running track across the whole building incase you didn't want to go running in the trivago gym. From there I headed down to the terrace where I joined one of the teams who were having a team barbecue on the 5th floor terrace.

Day 2 of the course took place in the trivago theatre, yes trivago has a theatre! We focused on what was new in JavaScript and learnt how to properly use the rest and spread operator. Then on to destructuring which I found really useful especially going through the many different patterns for both arrays and objects. Then on to Interpolated string literals, Iterators and Generators and Array includes and find. Yet again after an amazing day of the workshop I had to go and explore more floors of the trivago office. Finding more rooms including a a music room, a cinema director's room, a kids club room, a knitting room and an art museum room.

Day 3 of the workshop was on rethinking Async. This is where we learnt how JavaScript is single thread. One piece cant override or interrupt another. One function will always finish before another one will start. What parallel means — 2 or more things happening at exactly the same time. Like a queue on a rollercoaster. You all get on and have the same experience. And Concurrency — 2 or more things happening over the same period of time. Rollercoaster, only one goes on the ride but as soon as the car leaves another car arrives and the other person gets on etc. lots of people getting to ride over the same time.

We then learnt how to better understand callbacks which represent work that we want to occur at a later time. They have a now part and a later part. Callbacks could be called continuations as they are when the program continues at a later stage. We went over what exactly callback hell is and how to avoid it and went over thunks and promises. I think you can easily say that we all loved Kyle's definition of a promise and for sure will remember it forever.

A promise is like an IOU from a restaurant, its a promise for a future cheeseburger. Hand in the placeholder(receipt) and you get the cheeseburger. A promise is a future cheeseburger.

After promise all, promise race and observables I went straight from trivago to a company next door called Invison for a meetup along with some others from the JS workshop. Here we got to live code along building a react app with apollo and graphQL. Really interesting meetup and so easy and nice to work with graphQL.

Day 4 we started part 1 of Funcional Light Programming. The difference between Imperative — how things are done and Declarative — Why we are doing it. We also learnt the rules of functional programming and that a function doesn't just take inputs and computes outputs it only takes inputs and computes outputs. But as always there are many sides to the rubric cube and there are always exceptions to the rules. Functional programming says no side effects. Side effects can include input, output, writing to the DOM, writing to files or databases etc. We have to do some side effects of some sort. The rule is to avoid side effects wherever possible as most bugs will come from side effects so if you know where the side effects are in your programming then you would know more or less where the bugs are. We learnt what a pure function is and how to purify it if it isn't pure. And then learnt about closures.

Functions close over free variables the ones that are outside of themselves but that they make reference to. In functional programming we are closing over state that is never changed unlike normal closures where we have changing state in the closures.

After an exhausting day I got to team up with a few others and we explored the remaining floors of the trivago offices and stopped for a while to play table tennis on the terrace, table football in the kickers room, a bit of golf in the golf room and then finished up with a massage in the massage chair of the relax room, as you do.

Day 5 we finished off Functional Light Programming by taking a look at Partial Application takes a function with multiple parameters and returns a function with fewer parameters and Currying — the process of breaking down a function into a series of functions that each take a single argument. Currying looks less convenient, but it is more convenient than partial. We then moved on to Recursion — iterating over an operation by having a function call itself repeatedly until it arrives at a result. Describe what my problem space is — reduce the problem space either by half or by one or whatever and keep repeating that until i eventually get my answer. We then went on to work with lists with the map, reduce and filter functions. And after some challenging exercises it was time for a few well deserved beers.

As it was Friday we got to take part in the trivago Fridays where we went to the 5th floor terrace for some beers and a barbecue. It was great to mix with the rest of the people on the workshop and get to know Kyle better. All in all it was an amazing experience. I feel I learnt so much and have improved my JavaScript knowledge immensely.

It was also great to explore the trivago offices and visit their amazing rooms and many kitchens making you feel like in any moment you can just be in another part of the world, relax, be more creative or just look for some inspiration. I really do wish more companies would realise the importance of having this type of workspace where you just feel at home and at ease at every moment. But for me the highlight of my trip and what I loved about trivago was the sense of community. At any given moment you just felt welcome and part of the team. With so many people from so many countries it was really great to get to know and hangout with so many great people and really feel like you belong. Thanks Bluekiri, Kyle and Life at trivago for an amazing experience.