📜 ⬆️ ⬇️

A game for the little ones is a simple idea that is not a shame to include in the resume

Prehistory


My son, like all the children of programmers, probably got his first keyboard when he couldn’t sit. Now he is a little less than a year old, but he already understands the difference between the "toy" and the "real" (Daddy's) keyboard - if you pound the buttons of the present, the picture changes on the screen, and the computer sometimes makes some sounds.

KDPV

Since I don’t want to lose all my data, the child is sometimes allowed to click on the buttons of a locked computer. Unfortunately, for a child it is not very fun, because the computer has only two modes (two pictures) - the password entry screen and the actual lock screen.
')
To make the process of mastering a computer more interesting for a baby, I decided to write him a simple game. Being an experienced programmer, it was decided to build the whole process “correctly”.

Requirements


The customer (my son, age <1 year), like all normal customers, found it difficult to write in writing the consistent and complete requirements for the product, so I had to help write myself.

Functional:

Not functional:

In addition, it was decided to use a flexible, iterative approach to development with small development cycles resulting in receiving feedback (SCRUM).

C # and Visual Studio were chosen as the programming language and development environment, as they provided the performer with the highest speed.

Implementation


From one of the old projects, the code was extracted to create an application deployed in full screen:
FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; var screen = Screen.PrimaryScreen; Bounds = screen.Bounds; 

Further, the MouseKeyHook library was found in the wilds of the Internet, with examples of how to block the Windows button. Similarly, the examples were blocked by Alt-Tab and Ctrl-Esc. Now you can exit the application only by Alt-F4.

Next, code was written that initializes the random background color for the pressed key:

The first alpha tests on themselves revealed the following implementation flaws:

In the second iteration, the following changes were made:

Alpha testing on itself was quite successful and a demonstration was held to the customer.



The customer showed interest in the product, allocated 2 minutes for testing, evaluated the work as a whole positively and pointed out the following disadvantages:

Inspired by the support of the customer, the author’s team conducted a retrospective and made the following conclusions:

For audio feedback, it was decided to make sounds that correspond to notes (piano keys). A quick search on the Internet made it possible to find a formula for calculating the frequency of sound for each key, and this formula was promptly implemented in the C # code. Console.Beep is used for direct sound output to the speakers (and that works the same!).
The first run showed flaws:

Based on the results, the following changes were made:

This version was highly appreciated by the team, and since there was some time left for the customer to demo, the team decided to refactor:

Total


As a result, we got a funny toy for a child, which develops fine motor skills and memory (for favorite colors and notes), as well as code that can be used to demonstrate the implementation of the “right” approaches. For example, for students or junior-developers.

Here is a list of what you can learn by toy code:

The ready code is laid out as an open repository on GitHub and is available with a MIT license.

ps KDPV © kobyakov

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


All Articles