To reply to myself, because it merits its own giant text box: for anarchist-minded folks like myself, I'd highly recommend reading Homage to Catalonia, because it gives some glimpse of how things might work in a less-hierarchical military (in the cases like in Trek's Starfleet that weapons are sometimes unfortunately needed).
https://gutenberg.net.au/ebooks02/0201111.txt
The main sections I want to quote are:
The essential point of the system was social equality between officers and men. Everyone from general to private drew the same pay, ate the same food, wore the same clothes, and mingled on terms of complete equality. If you wanted to slap the general commanding the division on the back and ask him for a cigarette, you could do so, and no one thought it curious. In theory at any rate each militia was a democracy and not a hierarchy. It was understood that orders had to be obeyed, but it was also understood that when you gave an order you gave it as comrade to comrade and not as superior to inferior. There were officers and N.C.O.s but there was no military rank in the ordinary sense; no titles, no badges, no heel-clicking and saluting. They had attempted to produce within the militias a sort of temporary working model of the classless society. Of course there was no perfect equality, but there was a nearer approach to it than I had ever seen or than I would have thought conceivable in time of war.
But I admit that at first sight the state of affairs at the front horrified me. How on earth could the war be won by an army of this type? It was what everyone was saying at the time, and though it was true it was also unreasonable. For in the circumstances the militias could not have been much better than they were. A modern mechanized army does not spring up out of the ground, and if the Government had waited until it had trained troops at its disposal, Franco would never have been resisted. Later it became the fashion to decry the militias, and therefore to pretend that the faults which were due to lack of training and weapons were the result of the equalitarian system. Actually, a newly raised draft of militia was an undisciplined mob not because the officers called the private 'Comrade' but because raw troops are always an undisciplined mob. In practice the democratic 'revolutionary' type of discipline is more reliable than might be expected. In a workers' army discipline is theoretically voluntary. It is based on class-loyalty, whereas the discipline of a bourgeois conscript army is based ultimately on fear. (The Popular Army that replaced the militias was midway between the two types.) In the militias the bullying and abuse that go on in an ordinary army would never have been tolerated for a moment. The normal military punishments existed, but they were only invoked for very serious offences. When a man refused to obey an order you did not immediately get him punished; you first appealed to him in the name of comradeship. Cynical people with no experience of handling men will say instantly that this would never 'work', but as a matter of fact it does 'work' in the long run. The discipline of even the worst drafts of militia visibly improved as time went on. In January the job of keeping a dozen raw recruits up to the mark almost turned my hair grey. In May for a short while I was acting-lieutenant in command of about thirty men, English and Spanish. We had all been under fire for months, and I never had the slightest difficulty in getting an order obeyed or in getting men to volunteer for a dangerous job. 'Revolutionary' discipline depends on political consciousness--on an understanding of why orders must be obeyed; it takes time to diffuse this, but it also takes time to drill a man into an automaton on the barrack-square. The journalists who sneered at the militia-system seldom remembered that the militias had to hold the line while the Popular Army was training in the rear. And it is a tribute to the strength of 'revolutionary' discipline that the militias stayed in the field at all. For until about June 1937 there was nothing to keep them there, except class loyalty. Individual deserters could be shot--were shot, occasionally--but if a thousand men had decided to walk out of the line together there was no force to stop them. A conscript army in the same circumstances--with its battle-police removed--would have melted away. Yet the militias held the line, though God knows they won very few victories, and even individual desertions were not common. In four or five months in the P.O.U.M. militia I only heard of four men deserting, and two of those were fairly certainly spies who had enlisted to obtain information. At the beginning the apparent chaos, the general lack of training, the fact that you often had to argue for five minutes before you could get an order obeyed, appalled and infuriated me. I had British Army ideas, and certainly the Spanish militias were very unlike the British Army. But considering the circumstances they were better troops than one had any right to expect.
As much as I'll happily rag on the prequels, I think a lot about a line from the Phantom Menace, as said by Yoda: “Fear is the path to the dark side…fear leads to anger…anger leads to hate…hate leads to suffering.”