Fortunately, if you can already write code, you've already trained your analytical thinking skills and mathematical ideas should come naturally. I believe the best way to learn math is with the help of a high-level programming language, and I predict that in the not-so-distant future this will be the norm in math classrooms.