Castling is usually a good move, but not always. If the centre is closed and your opponent can generate strong attacks on the wings, it is better to keep the king in the centre. In a recent game which I played at letsplaychess.com, my opponent castled and I did not. His castled position led to his quick downfall. My opponent was Hillwalker of Scotland who played black. Here are the moves of the game with my commentary.
1. e4 Nc6
Black's move is unusual. The reply Nf6 is far more common.
2. d4 d5
3. e5 a6
I decide to keep my pawn on the board and maintain a strong pawn centre.
4. h3 Bf5
5. Nf3 e6
6. Bd3 Nb4
I challenge black's light-squared bishop. To my surprise, he does not take it but advances his queen knight.
7. Bxf5 exf5
Black has doubled pawns on the f-file.
8. a3 Nc6
Black is forced to retreat the knight.
9. Nc3 g6
10. Bg5 Be7
11. Bxe7 Ngxe7
12. Qd2 0-0
Black's decision to castle gives me a clear strategy. I want to attack on the h-file.
13. h4 b5
14. Ne2 Kg7
I shift my knight towards the h-file. Black's last move is not the best. A better move is h5. Black is weak on the dark squares.
15. h5 a5
16. hxg6 Nxg6
Black resigns. I have mate in one. If he plays Kh8 or Kg8, I play Qxh7#.
Castling is usually a good move but in this game it proves fatal for black. The centre is closed so the king is safe there. In this game black attempts to generate counterplay on the queenside but loses because of my strong pawn centre and control of the h-file. Though castling is often a very good defensive manoeuvre, in this game it is much better for black not to castle.