H-bridge in code

So I was going to make an h-bridge circuit to control a motor in two directions. Does anyone know if I could just use code to make one. I know you can change the way that current goes through a gpio but I also know when a motor is going in one direction and then directed in the other that there will be a surge of current higher than normal due to conductance. Somethings telling me not to do it in code its safer. But I also heard Brandon Harris on a podcast (Amp Hour) say that you basically cannot mess up the imp with code.

Any way what do you guys think?

I think this is podcast he refereed to

You have to be dead certain you never turn on transistors one and two at the same time, or three and four, or you have fried your transistors. For this reason it is much safer to use an bridge driver IC like the L293D, depending on your current requirements.

You arguably can’t mess up an imp with code, but you can certainly mess it right up with hardware controlled by code!

Peter