Congratulations! You have just been hired for your first job in a dynamic company which designs and builds state-of-the-art embedded systems. This is your first day at work, and you have already been given a top-priority assignment.
Bob has been hired a few weeks ago. He was performing well until he electrocuted himself while analyzing the design of a competitor new toy named “my first electric chair, for kids”. Unfortunately, he was working on your company flagship project, and the distributors come and visit tomorrow to get their hands on your first prototype in order to decide whether they will fill their stores with your product or not. If they do, everyone at your company is going to be very rich (except people hired since less than 3 months ago), and if they don’t, the chances of the company going bankrupt in a few months are somewhere between 0.99 and 1.
Bob was a solo programmer who did not see the point of using a revision control system, since all the revisions were in his head or somewhere in editor backup files. He kept regular backups on his own USB key, which is now a melted piece of garbage still located in what used to be Bob’s trousers pockets. One company executive who had heard about a system called git created a repository and put Bob’s current code in it. Your job is now to work from this repository and make sure your bosses are getting rich.
The chief executive officer gives you a quick talk about what the new product is going to do:
- Its internal temperature is displayed on the second line of a 2×16 LCD display.
- The left switch can be used to switch between Celcius and Farenheit modes.
- The first line of the LCD display scrolls permanently and indicates how to switch between the two (°C and °F) modes.
- The backlight display will stay on for 10 seconds when the systems starts, then for 3 seconds each time the right switch is used.
- Some chirping sounds (a double one when the board starts, a single one when the user presses the left switch) can be heard.
You are starting to realize how innovative this product is: no other product on the market displays only its internal temperature, and you have not heard of anyone working on one. Your bosses are probably geniuses and visionaries at the same time.
Since the executives do not want you to reproduce Bob’s unfortunate accident, at least not until the product has been put in the stores, they give you a few simple directions that you must follow. If you do fail in following those rules, not only you will not get payed for what you did but also you will forfeit an entire month of salary. The rules are:
- You are not allowed to play with any electrical chair, be it a real one or a toy, unless your code is provingly working well and has been checked it in Git.
- You must fix the bugs one at a time, each one in its own commit with a clear message explaining what the problem was. Also, your git must be correctly configured to display your name and a valid email address in the author field.
- Your job is to fix the bugs, not rewrite the code. Don’t forget, Bob was trusted by the executives, and you are not. However, once all the bugs have been fixed, you are allowed to rewrite some expressions that you would find unclear by prefixing the git commit message with “Refactoring: ” (without the quotes). You will probably get a bonus for every piece of code you make clearer.
- You must push your changes into a branch named after your first name in lower case and without accents, with an hyphen between parts if your first name has several parts. For example, “Marie-Séraphine Trabalda” would use “marie-seraphine”.
- You are not allowed to push into the master branch. This one is reserved for the CTO, even though he has to learn how to use git. Pushing into the master branch would be equivalent to walk on the CTO finest carpet with dirty rainboots after a visit to the nearest pig farm.
- To prove that you stayed a full day, you are not allowed to push into your branch before being told to do so. Once given the authorization to push, you will have five minutes until the central repository is considered sealed, and products will be manufactured using your code as present in this repository.
You were told that Bob often said that his code was either perfect or better than perfect. That should be an easy task.
And there, you begin the challenge by cloning firstname.lastname@example.org:rose2013/temperature.git, and your journey starts here…