The perpetrator in a school shooting usually acts based on some sort of grudge, but in this case none is obviously apparent.
If police have not found any note or communication yet, they have to speculate about the motive. I suspect the core theme is his targeting of girls. He might have been spurned by a girl and wanted to get his own back. Most of these attackers are pupils who go (back) to their own schools in order to perpetrate these tragedies. It's a common denominator from Columbine onwards. Schools are easy targets and it's the ultimate attack on innocent victims.
Since the shootings at Virginia Tech in 2007, there has been plenty of speculation about these events as "payback", the killers becoming celebrities with some sort of perverted sense of vengeance against the world. For a killer not to have left a legacy for us to uncover is extremely unusual. Perpetrators usually want to have their behaviour understood, for people to know why they have done it and who is to blame.
There's too little information to speculate on this German case.
What we do know is that licensed firearms are still available legally in Germany and the gunman stole the weapon from his parents' home. This raises as many questions about firearm storage as it does about this particular killer.
The author is professor of criminology at Brighton University