Abhinav Rai

GoJek Bootcamp 03 — Hell of an experience

I did my 2017 summer intern at Go-Jek and since then, the mystery of bootcamp has always fascinated me. One of the things I was majorly excited on getting the full time offer was the Bootcamp. Every new recruit at Go-Jek has to go through this rigorous drill. This philosophy came from Thoughtworks along with the present CTOs.

Bootcamp is one of the things which had a great impact on my life. The way I think, perceive things, make judgements, debate, argue, act and much more.

The bootcamp was divided in 6 modules.

Timeline for GoJek Bootcamp 3 Timeline for GoJek Bootcamp 3

Core Engineering

Bootcampers 2018 — GoJek. Notice our rm -rf tshirts Bootcampers 2018 — GoJek. Notice our rm -rf tshirts

Core Engineering, the first module of the bootcamp was taken by Sidu Ponnappa, Rajnish Dashora, Sahil Kharb and Iqbal Farabi. We were to do everything in the morning sessions in Java and repeat the same task as homework in ruby. This module was for 4 weeks duration. There were 10 non — negotiable etiquettes to be followed at all times and violation of which will result in rm -rf for our task. These are the 10 commandments for a programmer.

  • No tabs, only spaces A tab is different amount of spaces depending on the environment but spaces are always one
  • Indentation and spacing between code constructs Classes, methods, specs should be consistent. Indentation be based on the accepted convention for the language. Eg: 4 for Java, 2 for ruby.
  • New line at EOF Git wants new line at end of each file. It gives you a warning if you don’t do so.
  • Accepted naming convention for the language snake_case for variables in ruby, camelCase for variables in Java, etc
  • Accepted file/directory naming for the language Different languages have different conventions. In Java, class file name should start with capital while it should be snake_case in ruby
  • Use namespaces
  • No comments / Unused code Why do we need comments? Make the code explain itself using specs.
  • Runtime environment should be consistent with IDE We should be able to run specs and application from both IDE and command line.
  • Use .gitignore
  • Always do BDD One spec per commit

But why core engineering?

The code we write is the direct result of the way we think and design. So to make a person a better programmer, you got to clear their slate by removing their confusions. By making them debate on their approach and letting them explain why their approach is better than others. By contradicting them and giving them the realization of solving the problem in multiple other ways till the whole group is convinced on one approach. Core Engineering was not a Java/Ruby learning camp; it was designed on how to approach a problem and the do’s and don’t principles you should have in mind while looking for solution. It was a journey in itself on how should you think about the problems.

We were given simple toy problems.

  1. Calculating the distance between 2 points
  2. modeling money in rupee and paise
  3. modeling a rectangle
  4. making a calculator

It was through these problems that we learnt various OOPS and programming concepts.

BDD

We started with the buzzwords — TDD & BDD. What are they and Why are they important? What are the tests? What are specs? What is Unit testing and how is it difference from BDD? Why and when should we use BDD? These are the questions which we feel we have the answers to but how different are these from one another was from where the clarity came. BDD is the process of approaching a solution to the problem by limiting your scope and working on a small step towards solving the bigger problem. We write the spec for what we want to achieve and the bare minimum code to make the spec pass. By the Red, Green, Refactor, Commit Cycle.

Some Rules

Rule of 3: Any common thing if occurring thrice, just refactor or automate. Quite an important principle for when to refactor and when to automate.

Focus on tools: Tools are programmer’s third best friend (after dog and books). We worked on IntelIJ and RubyMine. The shortcuts like shift + F6, command + option + L etc had a great impact on increasing our productivity. Also we had typeracers everyday to increase out WPM metric to 50+. I have developed a liking for vim recently and its a powerful tool to use if you know how to use it.

OOPS: Ruby and Java are one of the best languages to learn OOPS. Basic questions like when a class is valid (both state and behaviour), is getter/setter a behaviour(No), when to use getters and setters, when to use interface, always override equality when comparison comes, override the built in toString and comparators, principles like tell don’t ask, DRY, SOLID, Law of Delemeter, SRP, KISS, YAGNI and the biggest EXPRESS INTENT.

Readme and LaundryList: Every project we make should have Readme and Laundry list.

Calibrations: Every monday we use to have calibrations. Solving Convay’s game of life. And commit every 10 min. We did that for 4 times with every time our solution becoming better and following more principles.

Never Love your Code: In order for us to be a better programmer, we cannot have strings attached to our code and would always have to be open to change. You only loose what you cling to — Buddha. I got rm -rf multiple times!

Apart from this, we had various philosophical sessions with Sidu on Money, Wishes, Saying what you mean, VLCC, Horse and Rider philosophy, etc and they were really amazing.

Devops

The second module of the bootcamp was Devops and was taken by Prashant Mittal and Debashish Ghatak. Its duration was 2 weeks. Devops is not a team or frameworks, but a philosophy. Earlier people who use to write the code and people who use to deploy it were different, leading to a lot of latency and delayed production. It makes more sense for the person writing the code to deploy it than some others. This philosophy is called devops.

Why do we need devops?

Our profile reads product engineer. We build products. So as a product engineer, we should know end to end of my product. Its my job as a products engineer. Coding the business logic to deploying it till the end (reaching to the end user and adding business value). Moreover in a fast moving environment, it makes more logic to do the same. Assume a company where a software engineer writes code and other deploys it. The other person has to know about the in and outs of the code before deploying. And lets say any bug comes, the communication overhead between the 2 teams is massive. The ticket generally just floats in the middle dropping the productivity and business value massively.

Learnings

We started with reading and understanding learn linux the hard way. And the biggest learning we got from this module is that Google and man pages are programmer’s best friend (even before dog and books!). We learnt on how to google effectively and what and how to google/duckduckgo when you are stuck.

Making the Code System Agnostic

We started with our first job as to make the code not dependent on the system we are on. We all had our Java Game Of Life project which we made in Core Engineering Bootcamp. All were made on OSX. Now we wanted to made the code system Agnostic. Say If I have a windows user, OSX user and Linux user in my team and I want them to run my Game of Life code.

One way is to write 3 Readmes. One for each. Another way is to fix an OS in the team. Say Linux. Now if we can make everyone access this from any system with the installed dependencies, our job is done. Thats where we learnt about VM’s and Vagrant. Vagrant is a tool which help us manage the Virtual Machine. Make a Vagrant file and use the file anywhere to replicate the machine. So the only instruction in Readme now is to install Vagrant in their machine and Vagrant up and everyone who wants to work has to just spin up the VM.

Continuous Integration (CI)

Continuous Integration (CI) is a development practice where developers integrate code into a shared repository frequently, preferably several times a day. Each integration can then be verified by an automated build and automated tests. When an integration breaks, everyone is notified to not push until the pipeline is fixed.

But Why CI? Its very easy to work in simple systems than complex systems. If we check for bugs on every small change, we can identify them very easily because the change is less. Simple to debug.This is the key benefit of integrating regularly. We can detect errors quickly and locate them more easily. As each change introduced is typically small, pinpointing the specific change that introduced a defect can be done quickly.

Continuous Integration doesn’t get rid of bugs, but it does make them dramatically easier to find and remove. — Martin Fowler

Deployment on Servers

With the CI pipeline now, any pushed commit is first tested and then packaged in an artifact (or may be going through some more stages of pipeline like linting, etc). We started with manually writing the Vagrant and Docker file for installing the system dependencies and then getting the packaged code and then deploying. But this is not automation and we would be repeating a lot in case of multiple deployments.

The main reason of doing all this is to automate the things. Programmers are lazy and if you are doing the same process the 3rd time, automate it.

Entry of chef! A framework who makes the dishes based on the recipes you create. Based on Infrastructure as Code principle. Meaning installing ruby 2.5.1 is an instruction which needs a spec too (Using kitchen). Implements DRY. We created our cookbook which has a lot of recipes. Recipes include installing ruby, installing artifact, installing bundler, installing openssl, running server, etc. Its based on the principle that every instruction is code.

Our server is up and running. But we need more than one instance of our application running. To distribute the load when the requests increase. We create another box which has a load balancer and balances the load. We used HAProxy for the same with round robin algorithm to distribute the requests. Also we need some monitoring system to restart the server on failure and alert us.

The last part was to deploy the same application using kubernetes. Why Kubernetes — Automation! Withing minutes we can have a new container ready with the desired cookbooks and can take down unused containers. Its a full package to scale your systems intelligently.

Security

It was a 3 day module where we learnt some common vulnerabilities in our codebase and the impact which they can have. There is no system which is 100% secure but we must try to build 99.99% secure systems.

We were given a simple CRUD app with vulnerabilities and we had to remove the vulnerabilities from the same and secure the app.

SQL Injection

We got to know what is sql injection and how it happens. How are prepared statements helpful and how they protect us from this vulnerability.

HTML encoding

We need to encode html when processing it. Else any intelligent HTML input might become a vulnerability.

Output Encoding

Similar to HTML encoding, its the duty of the backend service to give good sanitized data.

Authorization vs Authentication

I am authenticated to enter GoJek’s office but not authorized to enter the Nadiem’s office (our CEO).

Salts, MD5 and Bcrypt

We got to know why to use salts, what is the difference between encryption and hashing and how the modern day passwords are stored so that even if they are compromised, we don’t suffer a lot.

IDOR (Insecure Direct Object Reference)

Everyone should be able to see only what they are meant to. We should not be allowed to see someone else’s data. Manage the id’s and sessions well.

Some more learnings —

  1. Apart from that we learnt a bit about race condition and how to tackle them.
  2. We also got to know how android apps can be compromised by forgetting to change some defaults in manifest.
  3. We learnt about what GPG keys are and to use them to setup out gitlab account.

Android

It was 1 week module and was the most hectic one. We were to prepare Go-Movies app as shown below.

Majority of the people had never worked with android but transition to kotlin was not that difficult.

Basics

Android is an operating system for mobiles built over linux primarily for the touch screen devices. The latest Android Api is 28 (as on sep 26, 2018). Lollipop 5.0 is API 21. Company like GoJek has about 1% employee on API 16. 1% is roughly 10000+ people. So shifting an Api version could be really problematic. We have various workarounds in place for the same.

Designing the screens

We learned about different types of layouts — Linear, relative, frame, table. When to use which layout and view. We learned about designing these layouts in XML with different properties. We learnt the best practices of keeping the strings and dimensions in their separate file. Quite many people got rm -rf for the same. Android Studio is quite powerful and mostly all the shortcuts of IntelIJ work.

Gson

Gson is google’s library to parse Json. Convert a Json string to system’s object type (Java/Kotlin). We used this to convert the json data from tmdb apis to the kotlin object

Fragments

Activity consists of fragments. Fragments are the building blocks. They are like the lightweight activity. Drawing a parallelism to web. We open a single page website and all the views are there. Then we use JS to show one and hide other based on some event. Compare this to a page where we have to submit form.

Recycler View

As the literal meaning of recycle goes, we are reusing the things we already made. Say we have 100 movies to show. We can show them in list view too but thats not a good way. The advantage with Recycler view is that only 10 +4 movie cards will be made, as on the screen the max which we can view is 10. And as we scroll down, the movie cards gone at top are shown at bottom with data changed. Bind in adapter handles this mapping of data. This number to show the max movies and scrolling is taken care by layout manager.

Storing the data

We used SharedPreferences to store the data. We discussed how to read and write data to shared preferences. How is the data actually stored in phone and if its possible to read other app’s shared preference.

Debugging

We learnt how to use debugger in android and how useful it is when stuck. Android studio has great implementation for the same and its quite easy and trivial to use it.

Data Science

It was a 3 day module and we learned about how important and impactful it is to analyze the data. We currently serve 3 million plus bookings and have tremendous amount of data based on which we can make important decisions and make great features. Few applications include: marking pickup destinations, analyzing taste of user and showing targeted vouchers, showing estimated time arrival, choosing the best driver, pricing for the route, giving rewards, rating of user and driver, etc. These are the few areas where Data science finds its major application.

After oil and nuclear, today’s buzz is Data — Peter Thiel

We started with basics of ipython notebook. Got to know basic pandas apis — such as importing the data, sorting, filtering, basic statistics, etc.

Then we implemented visualization of data through bar, line, pie and box chart, histogram, etc. We also learnt about matplotlib library.

Linear Regression

Its a way to model the data. We have data. And we want to predict some thing based on this data. Linear Regression is one way to do it. Say we have the data for house selling price based on the house features (house_size, garage, condition, year_built, has_swimming_pool, etc) [Dataset] and we want to get the sale price of a house. We can model this linearly — as shown below.

Selling Price = Theta1 * [Feature1] + Theta2 * [Feature2] + Theta3 *             [Feature3] + …… + ThetaM * [FeatureM]

Feature values are numerical values. Theta are the coefficients. If we can tune the value of theta according to the data we have, we can just plug in the value for features for new data and we get the sale price for house. So our job is to tune these parameters now.

This is for y = mx+c. For one feature. For n features its an n dimension space with n-1 th dimension as correlating to line here This is for y = mx+c. For one feature. For n features its an n dimension space with n-1 th dimension as correlating to line here

Gradient Descent

Its an algorithm to find the minimum of the function. We have to come down from the hill, to the lowest value. We take the path with highest slope and come down. We used gradient descent by minimizing the error of linear regression. As we minimize the error function, our coefficient of linear regression(theta) will get tuned.

Logistic Regression

Logistic regression is used for converting linear regression to classification problem using sigmoid function and probability.

Kaggle

We submitted our first solution for Kaggle’s Advanced House Price Prediction Challenge and got our ranks based on the models we made.

IOS

It was 1 week module and we were to prepare a simple demo food app which shows nearby restaurants.

The coached started with the basics of what IOS is and the impact they have on the world. IOS is not open source unlike android which has its own pros (security) and cons(you cannot see the execution flow clearly). Then we talked about IOS in GoJek and saw the app. Most of us had never worked in swift and the first 2 days were spent on learning the basics of swift on Xcode 10 playground. We learnt about interfaces, best practices in swift and importance of time complexity.

Layouts

Unlike Android, we implemented the drag and drag layout in XIB and set the constraints using auto layout. We were to not use storyboard as its quite difficult to contribute in team with the same.

Threading

Its really bad to do loading of data and images on main UI thread. We should create another thread to do so.

List View

Just like the recycler view in Android, IOS also does the same and manages the resources well.

GoJek Codebase

We saw how the code is structured. How heavily are interfaces and other best practices used.

Speaking Drills

Everyday for 45 min, we use to have our speaking drills. The reason for it were to

  1. Leave your fear for speaking amongst people. You have to speak. You have to convey
  2. To make sure other people get what you actually want to say
  3. To convince other people logically and to disprove someone with authentic logical fallacies such as Argumentum Ad Populum, Reductio Ad Absurdum, Logical Consistency, Strawman, Empirical adequacy, Anecdotal evidence, etc.

Speaking is equally important as coding, to be honest more important than it. And significant weightage was given on the same during the bootcamp.

It has subconsciously impacted us to quite an extent that we can speak anytime anywhere and can contradict someone logically when we find some anomaly. It has given us a direction to debate.

TypeRacer

We use to have 3 rounds of type racing everyday before EOD. The goal was to have everyone’s typing speed above 50 Words Per Minute. My typing speed improved from 52 WPM to 60+ WPM. Typing is the most integral part in our career and having great typing speed is a significant advantage. You may check your typing speed here.

There were many days when we slept after 5:00 AM and woke up at 8:00 AM. Meeting these crazy people, getting to know them, working with them, sleeping together on bean bags, going out on vacation with them, having beers on weekend, bitching about Bangalore traffic, talking about our crushes, contradicting in speaking drills, the competitiveness in type racing, the fun on private slack channel, the late night home works, teasing one another, peer reviews and few outings; It was surely one hell of a bootcamp! One hell of a journey!

You may contact the author at me@abhinavrai.com