It just shows lack of:
1) intelligence-Having poor intelligence withing the community...they need to recruit Somali to give them regular intelligence and pay them handsomely.
2) Technology-Have proper live satellite data profiling human or object movement 300km radius 24/7.Also have drones to bomb such movements.
3) Human personnel-How can 200 soldiers battle 1000 soldiers? You need big battalions.
4) Betrayal-With the Ugandan soldiers being underpaid, there must have been a soldier who was given maybe $30000 usd to give intellgence to alshabab..I remember of of the El adde soldiers telling me some of the kdf were sellling weaponry to alshabab which meant incase of an attack they should have been slow to act to save ammunition....thats how stupid africans are...infiltration is a very big possibilty.
If technology,quick response,proper command,enough personnel and hardware was available...such eventuality would not have happened.