Thursday, May 05, 2011

Pavlik Morozov Anti-Pattern

Interesting recent topic in a work skype chat...


[2:27:50 PM] Richard: public Morozov must be what it is called in Russia because when I google that term all the results are in russian
[2:28:18 PM] Richard: I don't know why it is protected, the class is basically just a struct
[2:28:23 PM] Feodor: yes Richard, but I can tell you the story
[2:28:46 PM] Feodor: the story begins in the 20ies, right after the revolution in Russia
[2:29:05 PM] Richard: hehe
[2:29:13 PM] Richard: all the best C++ stories start with that line
[2:35:07 PM] Feodor: the boy because a central figure of the Soviet propaganda
[2:30:07 PM] Feodor: the socialist state required resources, first of all food to feed workers and soldiers, but the farmland was still privately owned and farmers demanded something for the food, like gold, while there was a hyperinflation of paper money
[2:31:53 PM] Feodor: the state decided to extract food by force, which resulted in a famine. Officially, it was disguised as a campaign against speculators who artificially drive commodities pries up
[2:32:42 PM] Feodor: so many people attempted to conceal some food, but the military used to kill everybody who attempted that
[2:33:08 PM] Feodor: so in this environment, there was a schoolboy and a young communist called Pavlik Morozov
[2:33:33 PM] Feodor: he knew his father concealed some flour in their farm
[2:34:13 PM] Feodor: and he summoned the soldiers and showed them the hiding place
[2:34:19 PM] Feodor: so his father was executed
[2:34:37 PM] Feodor: but his relatives reached him and killed the boy with an axe
[2:35:07 PM] Feodor: the boy because a central figure of the Soviet propaganda
[2:35:24 PM] Feodor: throughout the Soviet rule, his was portrayed as a hero
[2:35:49 PM] Feodor: and all schoolchildren were taught to praise him
[2:36:15 PM] Feodor: there were songs and books about him, memorials to him, there were streets named after him
[2:36:30 PM] Feodor: So, getting back to the 90ies
[2:37:24 PM] Feodor: there were lame Russian programmers who preferred to solve the problem of private methods by inheriting a class that opened them up
[2:37:36 PM] Feodor: and of course they remembered the story of Pavlik
[2:38:15 PM] Feodor: so inheriting  a class to make private fields public was called "public Morozov" pattern
[2:38:33 PM] Feodor: because you actually make private things public, like Pavlik did
[2:38:50 PM] Feodor: protected, to be precise