I personally love defensive play, but, it has to be done right.
First off, do what raaar said. Lotus in base, always.
That's because there are some really good raiders in the game that will wreck your world if they get into an undefended base with a single scorcher or a couple of glaives. Don't be the doofus that was microing his units at the front, and who comes back to find not factory and dead energy.
Secondly, ZK is anti-porc.
While its true that defensive structures are more powerful pound for pound than offensive units, usually when players turtle up they give up map. Giving up map means giving up metal. All things being equal, the team with more metal will win.
So you have to build porc at around the halfway line, as Zenfur said. That way you have at least equal resources. And now its the enemy that has to charge into units that are better than theirs per cost. Of course, the obvious reply to porc is artillery. But, as Zenfur said, porc needs artillery of its own. I see porc as a launch pad and base for offensive action. The artillery in porc is protected by the defences, and probably shields as well. It will out-duel the artillery in the open. As a result proper, halfway-on-the-map porc doesn't just protect what's behind it, but it also contests the map a long way ahead of it, effectively denying the enemy resources.
As Sparkles said, "defensive play is luring attack into territory that you are at an advantage reclaiming within." I agree 100%. My porc is always incredibly heavy with caretakers. Once I've beaten an attack off, plenty of juicy wreckage exists in a zone that I control, for reclaim.
Mature porc is almost impossible to beat with conventional means. But what will happen is that you will attract nukes, silo, tremor and DRP like a high powered magnet. Porc alone cannot win a game. Porc gives you the time and resources to build nukes, DRP, bertha etc before the other guy does.
Finally, what Firepluk said is indeed a viable option. I've seen him pop up a line of Desolators in the teeth of a coming attack and simply rip it apart. But its not an option for noobs and unless you really have your timing and resources right, you can lose big time getting it wrong.