How should I have decided which side to attack on? I played black and was a pawn up. My plan was to castle on the opposite side from white's king, then use my majority on that side to pawn storm him. So on the turn shown below, I was about to castle long.

After we drew, I analysed the game with an engine, which preferred castling short and pushing the a-pawn, so it seems I should have done the exact opposite of my plan.

My question is, how should I have decided on which side to attack in this position? Why was my choice wrong?

Thanks in advance.

[FEN "r3k2r/1bp2ppp/pp2p3/8/8/2qPBP1P/P1P1Q1P1/R4RK1 b kq - 1 16"]

1. e4 e6
2. e5 d5
3. exd6 Bxd6
4. Nf3 Nf6
5. Bd3 b6
6. Bb5+ Nbd7
7. Nc3 Bb7
8. d3 a6
9. Bxd7+ Qxd7
10. O-O Ng4
11. h3 Ne5
12. Nxe5 Bxe5
13. Qe2 Qc6
14. f3 Bxc3
15. bxc3 Qxc3
16. Be3 O-O-O
17. Bd2 Qb4
18. Be3 Qc3
19. Qd2 Qxd2
20. Bxd2 Bc6
21. Bc3 f6
22. Rad1 Ba4
23. Rd2 e5
24. Rc1 g5
25. d4 exd4
26. Rxd4 Rxd4
27. Bxd4 Rf8
28. c3 c5
29. Bf2 Re8
30. Re1 Kc7
31. Bg3+ Kb7
32. Rxe8 Bxe8
33. Bd6 f5
34. g4 fxg4
35. hxg4 h5
36. Be7 hxg4
37. fxg4 Bd7
38. Bxg5 Bxg4
39. Kf2 Kc6
40. Ke1 Be6
41. a3 Kb5
42. Bd8 Ka5
43. Kd2 Ka4
44. Bxb6 c4
45. Bc5
You should castle "short" (on the king side). because you want to attack on the queen side without exposing your king.

1) White is short a pawn because of his missing b pawn. If you castle "long" and put your king on that side, White's open b file (and the black diagonal to b6) become compensation. If you don't, he's just a pawn down.

2) Your queen is powerfully placed on the queen side. You want to move up your pawns to support your queen, without exposing your king, or allowing your queen to be "pinned" by a rook. White has his queen on the king side and you don't, so it doesn't make sense to attack there.

3) Your best chances of getting an "outside" passed pawn are on the a and b files, so you want to advance those pawns, with your c pawn in support.