As an electrical engineering student, the only programming classes I ever took were Fortran and assembly for embedded systems design. I used the assembly language as needed to program 8051 or 68HC11 and equivalent microcontrollers.
My primary programming language—if you could call it that at that time—was Matlab. Matlab was great for my needs, as I was almost always dealing with matrices consisting of complex numbers and wanting to plot results.
When I got into graduate school, I took a computational electromagnetics (CEM) course that required you to develop three different programs:
- Finite-Difference Time Domain (FDTD) solver
- Finite Element Method (FEM) solver
- Method of Moments (MoM) solver
Since all I really knew were Matlab and assembler, I decided to write my first project—the FDTD solver—in Matlab. This turned out to be a colossal mistake. I found Matlab's Achilles' heel—stepping through matrices one individual element at a time, which is required in an FDTD solver.
It took 2–3 hours to run the solver, and then many times I'd find an error. Even when I reduced the problem size, so that the matrices were relatively small, the time it took to debug was still unbearable.
For my second project—a FEM solver to calculate the characteristic impedance of a coaxial cable—I decided that in the 5 weeks we were given to complete the project, it would be faster for me to:
- Teach myself C
- Develop an FEM solver in C
That decision was one of the better ones I've made. With a copy of The C Programming Language, 2nd ed. by Brian W. Kernighan and Dennis M. Ritchie, I taught myself C.
I still have the source code from back in 1999 when I took the course. It consisted of one function—main()—and was some pretty ugly code. But it sure was faster than waiting on Matlab.