It's important to realize that the coding techniques you learn should not be applied blindly, without thinking.
That is, while a practice can indeed be applicable most of the time, there are very few rules which should
absolutely never be broken.
Rules are blind, in the sense that they often don't deal with the full context of a problem, or the complete picture.

You shouldn't be afraid to consider breaking the rules, if you have thought about the problem,
and when you feel it's an appropriate thing to do.

When you begin your career as a programmer, following a standard set of rules is likely appropriate.
But as you progress, your skills become stronger, and you start to develop something which is lacking in the beginner - a sense of taste.
This sense of taste, this wisdom which you've acquired through real experience, is what really guides a mature programmer.
In essence, wisdom transcends rules.