A non-militaristic barracks pays off in terms of hitpoints-per-shield after you spend 160 shields on military (including the cost of the barracks). A babylonian bowman rush, for example, would not use a barracks.
The warrior -> swordman upgrade is interesting since you are limited by gold as well as shields. Using the exchange rate 1 shield = 2 gold, a non-militaristic barracks pays off after 4 warriors.