How To Write A Code In Mind

Statue
 

Many software developers think about the architecture, use cases, and possible extensions before writing code — and this is a good practice. However, we can go even further and start writing code in mind without using a computer!

Concentrate

Concentration

It is the very first thing you have to do. You need to imagine very clearly what exact code you have to write and how to do it.

Requirement analysis is an excellent place to start. You need to remember all the requirements for the requested feature, check them, and understand what exactly the customer wants.

Then you should remember all technical components (frameworks, libraries, etc.) that may help you here. The more things you can keep in mind, the better. You will be able to use all these components during the following phase.

You may also remember all the best practices in writing functional and clean code. Again, the better you prepare now, the easier it will be for you later.

Write

Thinking

Now you have actually to write a code in your mind. Imagine an IDE or any other editor you know well and start writing a code line by line, class by class, file by file.

You should check your code with imaginary code style tools to guarantee that is is easy to look at and understand from the first thought. Similarly, you may cover this code with automated tests also written in a similar way to guarantee this code works as expected.

After you finish the code writing phase, you should have a look at the code or application you have created. Make sure that you understand all parts, all dependencies, and the way it is going to work.

Execute

Meditation

Finally, it is time to try to run the code you wrote! You have to concentrate again and virtually become a computer or a virtual “virtual“ machine. You should go through the code line by line again, but now you have to execute it, store the results in your memory, and write the results somewhere (or remember them in your “cache“ memory).

The critical part of this process is garbage collection. Sooner or later, you are going to become tired, get a headache, and so on. To prevent these negative consequences, you have to collect all the garbage in your mind and literally through it away — i.e., forget about it.

Congratulations! If you did everything correctly, you could now write and execute code using only your mind. You do not need a computer or any other mechanical tools any longer — you can do everything by yourself! As a consequence, you may save time and money and spend then visiting your new friends — Alice, the white rabbit, and your favorite psychotherapist. Just relax and stop believing everything you find on the Internet on Fool’s Day!

 
Yevhen ShyshkinComment