Skip to content

Instantly share code, notes, and snippets.

View gonutz's full-sized avatar

gonutz

View GitHub Profile
@gonutz
gonutz / cleaner_code.md
Created May 29, 2025 13:58
Cleaner Code

Cleaner Code

In Robert C. Martin's 2008 book Clean Code there is a code example in the chapter Meaningful Names, in subsection Add Meaningful Context. The purpose of the code is to print guessed characters in a game, like this:

There are no Xs
There is 1 Y
There are 23 Zs
@gonutz
gonutz / readability.md
Last active May 29, 2025 13:29
Readability is Paramount

Readability is Paramount

I was pointed to a blog post about some new features in C++, the first language that I learnt when I started programming 15 years ago.

The author, a member of the C++ Standardization Committee, gives us an example of some basic algorithm to illustrate the use of a new C++ feature that he worked on. The task is rather simple: find triplets of integers a, b and c where a²+b²=c². Here are some examples:

3 4 5      because 3*3+4*4 = 9+16 = 25 = 5*5
6 8 10     because 6*6+8*8 = 36+64 = 100 = 10*10
5 12 13    because 5*5+12*12 = 25+144 = 169 = 13*13