Every action that a communist takes should be done with the intention of moving towards a revolution. Every communist should also understand that a revolution cannot be successful unless the majority of the proletariat in that country supports it. These two theses should make it obvious that education and agitation of the masses must come before violent direct action.
Why? Because if violent direct action is undertaken first, the masses will turn against the communists who participate in the action.
The classic example of this is the Reichstag fire. One month after Adolf Hitler became chancellor of Germany, a Dutch communist set the Reichstag (German parliament building) on fire. There are some theories that this was a false flag attack that was carried out by the Nazis in order to blame the communists, but for now, let us assume that it was legitimate. Had the German masses been properly educated about communism, then this action could have served as a rallying point to inspire more people to take up arms against the German state. But, since the masses were not educated about communism, Hitler exploited this situation by claiming it was a communist plot to take over Germany, which turned public opinion against the communists. This meant the attack had the exact opposite of the intended effect - it turned people away from the communists, instead of turning them towards them.
A more recent example is Micah Xavier Johnson's attack on police officers in Dallas, Texas. This one seems to have been a knee-jerk reaction done purely out of spite. Regardless, it turned public opinion against the Black Lives Matter movement, because the masses of the United States were not properly educated about communism, and the necessity for revolution. Communists probably celebrated behind closed doors, but overall, this was disastrous for the revolutionary movement.
For an example of this happening on the other side, take a look at the murder of Heather Heyer at the Unite the Right rally in Charlottesville, Virginia. This one was probably also a knee-jerk reaction by the driver of the car, but even more so, because he probably only decided to drive through the protesters a second or two before actually doing so. The result was a massive backlash in public opinion against neo-nazis and the "alt-right." Had they done their education and agitation properly beforehand, then this could have worked in their favor, but it didn't (and many of them probably recognize this, and wish their people would have more self-control).
It always seems to be anarchists who advocate for immediate direct action like this. When I give this argument to them in real life, they usually say things like, "But we have to do something to fight capitalism!" These people evidently don't understand long-term strategy. Some of them go on to say, "You just don't want to do violent direct action because you're a coward," or, "Anyone who opposes violent direct action for any reason must be a liberal or a fascist." These last two are beneath comment.
There is a time and place for violent direct action. Once proper education and agitation of the masses has been carried out, violent direct action can serve as a rallying point to further agitate more workers, and bring the revolution closer. But in nearly all capitalist countries of the world, these conditions have not been met, so doing violent direct action now would turn the masses away from communism, and set the revolution back. So have some self-control, be patient, and get to work on educating the masses.