Why every mechanical engineer should know how to code

Soham Ghormade
4 min readDec 13, 2020
Joys and sorrows of coding. Source PhD Comics

If the article title caught your attention, you are likely a mechanical engineer.

As a mechanical engineering graduate, there are a variety of opportunities to pursue.
For the purposes of this article, let us consider the field of design and manufacturing.

In this field, the following is a possible sub set of opportunities:

  • design engineering if you are interested in machine design,
  • Finite Element Analysis(FEA) and Computational Fluid Dynamics(CFD) if you like simulation.

Both the above fields have software tools associated with them(Table 1).

The table lists out the languages used to build the tools.

+-------------+-----------+-------------------+---------------+
| Tool | Language | Application | References |
+-------------+-----------+-------------------+---------------+
| MATLAB | C/C++ | Control Systems | Wikipedia |
| | | and Robotics to | |
| | | name a few | |
+-------------+-----------+-------------------+---------------+
| SolidWorks | C++ | CAD | StackOverflow |
+-------------+-----------+-------------------+---------------+
| OpenFOAM | C++ | CFD | Wikipedia |
+-------------+-----------+-------------------+---------------+
| ANSYS | Python | CAE | PyPI |
| Mechanical | API | | |
+-------------+-----------+-------------------+---------------+

Table 1: A sample set of applications used by a student studying mechanical engineering. The References column includes links to web pages mentioning the programming language used by the respective tool.

Now, depending on your background, you may know a bit of coding as a result of

  • CS101 classes or learning online on education platforms like Coursera or Udacity,
  • or are a pro e.g already working as a software developer,
  • or are somewhere in the middle.

If you are a pro, you can skip the rest of this article since you are already sold on the concept of why coding skills are important.:-)

“Everybody in this country should learn to program a computer, because it teaches you how to think”

Steve Jobs

If you are at rookie or amateur level, the reasons in the following section might motivate you to improve your coding skills.

Or perhaps even switching over to software development entirely.

Without further ado, here are the reasons:

1. Learn how engineering softwares work “under the hood”

Engineering softwares, are created by software developers using programming languages.

Therefore, by “under the hood” in the title of this section, I mean you get closer to the logic of how the calculations happen.

For example, for an FEA problem (Figure 1), you might know the input — boundary conditions and the output -stresses and displacement for a static structural problem. But there might be details at the Matlab matrix solver level which are interesting and challenging to understand first and then develop further perhaps. The same argument applies to FEA solvers like APDL from Ansys.

Figure 1: 2-D plate to demonstrate static structural analysis using MATLAB.
Figure 2: Stress values generated using MATLAB for 2-D plane.

2. More number of jobs looking for software developers

Software developer jobs are more abundant than Mechanical engineer jobs going by the official data.

Specifically, according to the Bureau of Labor Statistics, employment for software developers is expected to grow at 22 percent in the 10 year period from 2019 to 2029 compared to 4 percent for mechanical engineers for the same time period.

Now that you have reached this part of the article, you are likely convinced that programming is a good idea.

So the next question is :

What are the next steps ?

There are two broad options usually :

Option 1:Hard to easy

In my experience, Let Us C++ is a good book to start learning C++. It explains concepts in an easy to understand manner and in fact also includes examples from the mechanical engineering domain which are easy to relate to.

If you have more time, starting with C and then moving to C++ is a good idea. This is because C++ is a superset of the C language.

Once you understand C++ you can pick up other languages. This is the harder but good route if you are low on time especially if you are targeting C++ software developer roles.

Option 2: Easy to hard

An alternative route could be

  • to start with a beginner friendly language like Python and
  • progress to C++ as a second step.

The second step is optional and depends on your personal and/or professional interest.

For me personally, I went with the Option 1 above because I was more familiar with C++ syntax than python syntax when I first starting coding.

But looking back and given the fact that python does not use pointers, learning python would have been a more natural progression.

For interview preparation, Cracking the Coding interview and leetcode are popular options.

Conclusion

Hope this article provides others some context to take the next step towards becoming a software developer and perhaps even work at a software firm!

If you have questions, please feel free to leave a comment in the section below.

Make sure you give this post a few claps if you enjoyed this post and want to see more!

References

  • Sandip Jadhav’s post suggesting new graduates to learn C++
  • There are already a lot of articles on interview preparation. In case you are looking, this one seems to be a good one to start.
  • This is a python resource I found to be useful.

Acknowledgement

  • Thanks to Vivek Kulkarni for recommending me to start with the Let Us C++ book in my ongoing journey to improve my programming skills.

--

--

Soham Ghormade
0 Followers

A sofware engineer who sometimes likes to write in languages which do not require a compiler:-). Views are my own. Webpage:https://ghormadesoham.github.io/