📜 ⬆️ ⬇️

Code Retreat or exit comfort zone

Hello!

In early summer, many large companies conduct internships for undergraduate students and graduates of technical specialties. I was fortunate enough to join the ranks of such young specialists in SKB Kontur. Our acquaintance with the world of software development began with an event codenamed “Crash Course” - a four-day intensive away school. There was a lot of interesting, exciting and informative, but I would like to tell about one of our special entertainment in more detail. So today we have Code Retreat!

Code Retreat - what is it ?!


First of all, about the Code Retreat format. This is a developer meeting consisting of several programming sessions that satisfy simple rules:

At first glance, the event may seem mildly strange, with unusual, uncomfortable and unrealistic rules. But it is necessary to participate in it and the opinion is changing dramatically!

Eyes of the witness. How it was.


At the crash course I learned about Code Retreat for the first time and, as it turned out, not only me. It all began with a harmless first iteration, where we were offered to implement the game " Life ." We sat down in pairs, the timer was started and ...
')
Iteration 1

Limitations:
  1. The time limit is 45 minutes.
  2. It is necessary to get comfortable with the task, to program something.

It must be said that the majority had a solution ready after the allotted period of time and it worked. Then there was a 10-minute coffee break with cookies, juggling (?!) and complete removal of the written code! In addition, change pairs.

Iteration 2

Limitations:
  1. 45 minutes.
  2. Using TDD:
    • There is only one simple test in each test.
    • Each new test should be:
      • Early red
      • As simple as possible
      • As simple as possible
  3. For the keyboard, each for 5 minutes.

At the end of the standard operation with the removal of written code and eating cookies =) And, of course, changing pairs!

Iteration 3 (already interesting)

Limitations:
  1. 45 minutes.
  2. Restrictions on the size of methods - no more than 3 (!) Lines.
  3. For the keyboard, each for 5 minutes.
  4. The playing field is infinite.

This iteration has become much more fun! But ahead loomed the final, fourth iteration! And at first, you guessed it, removing the code and changing pairs!

Iteration 4 (very interesting)

Limitations:
  1. 45 minutes.
  2. For the keyboard, each for 5 minutes.
  3. At choice:
    • Do not use mouse
    • 3 min planning timeframe (The entire session consists of three-minute cycles. At the beginning of each cycle, the partners agree that they want to catch this cycle. If after 3 minutes after the start, the goal is not reached, then all code written for this cycle is deleted and the cycle need to start over)
  4. At choice:
    • No cycles.
    • No conditional statements.
    • No variables.

Honestly, the final iteration of the majority lasted much longer than 45 minutes, since everyone wanted to get a working program. And no one wanted to give up for a long time =)

Impressions


Two words: this is something! It is difficult to convey all the emotions of what happened in several paragraphs. The situation was heated up by the fact that we did not know what the limitations would be next time and on the first iteration they didn’t even know what would happen at the end. I liked everything! The feedback shared by the interns is only positive. I strongly recommend that anyone who has the opportunity arrange something like this.

Comprehension


What is the benefit of Code Retreat? In fact, here you can list all its advantages for a long time, but it is worth mentioning the main ones.

Total


Crash course is over, I described only one of the many attractions, but the internship in Kontur is in full swing! Good luck to all!

Thanks for attention! =) And be sure to try, you can unsubscribe about your impressions in the comments.

Code authors below Denxc and Sleipnir
Part of the code of the game "Life" from the last iteration.
/* : 1.  . 2.  . 3.   . 4.      3- . 5.    Game   60 . */ class Game { private HashSet<Point> aliveCells; private IEnumerable<Point> movingVectors = new List<Point>() { new Point(-1, -1), new Point(-1, 0), new Point(-1, 1), new Point(0, -1), new Point(0, 1), new Point(1, -1), new Point(1, 0), new Point(1, 1) }; public Game(IEnumerable<Point> initCells) { aliveCells = new HashSet<Point>(initCells); } public Game MakeStep() { return new Game(aliveCells.SelectMany(Neighbours).Where(ShouldAlive)); } public void Show() { Console.Clear(); aliveCells.Where(c => cX >= 0 && cY >= 0 && cX < Console.WindowWidth && cY < Console.WindowHeight) .Select(PrintPoint).ToArray(); } public bool PrintPoint(Point cell) { Console.SetCursorPosition(cell.X, cell.Y); Console.Write('*'); return true; } public IEnumerable<Point> Neighbours(Point cell) { return movingVectors.Select(c => new Point(cX + cell.X, cY + cell.Y)); } public bool ShouldAlive(Point cell) { var aliveNeighboursCount = Neighbours(cell).Count(aliveCells.Contains); return aliveNeighboursCount == 3 || aliveNeighboursCount == 2 && aliveCells.Contains(cell); } } //     : public static void Run(Game game) { game.Show(); Thread.Sleep(40); Run(game.MakeStep()); } Run(new Game(new HashSet<Point>() { new Point(21, 23), new Point(21,21), new Point(21,22), new Point(22, 21), new Point(20, 22) } ) ); 


Download the source code, the executable file and see the result here .

Source: https://habr.com/ru/post/187448/


All Articles