<img height="1" width="1" src="https://www.facebook.com/tr?id=1101141206686180&amp;ev=PageView &amp;noscript=1">

A Tip on IDE Setup to Make Programming Easier

We have come a long way in computer programming over our history. There was a time when we inputted data into our refrigerator sized computers with holes punched into paper cards. Obviously, our tools for coding and programming have grown much more sophisticated and powerful. But with this sophistication also comes complexity. I’ve seen may articles and lists floating around on good programming habits and coding techniques to make good code. But incredibly rare is the article that talks about tips on setting up the Integrated Development Environment. So, I will provide one. Here are 3 general tips on how to setup your programming IDE to help make your code development easier.

 

Use relative include paths

Engineers have been developing code for a long time. And, as the adage goes, engineers are lazy people. If there is a way to make life easier, we will invariably find and create it. One such manifestation of this is the widespread adoption and use of libraries. These resources are extremely useful in providing several prepackaged common functions and gives developers a single unified code base on which to test and improve. The use of this resource does present another challenge. By their nature as a shared resource, It is not necessarily true that the library files you are using are in the same location as your project files. How does the compiler know where to look to find your libraries? The answer is the use of include paths. These are file path setup for the project that tell the compiler where to look for share resources. An example of include paths is shown in the picture below.

Note that for example purposes, the screenshots are taken from Texas Instrument’s Code Composer Studios. Use of different programs will have a different interface but the basic concepts will be the same.

The above shows an example project setup include options. In this example, the project uses resources in a folder called IQmathLib. In this example setup, the desired folder is referenced in two different ways.

  • C:\Users\Yifang Yang\Test Workspace\lib\IQmathLib
  • "${workspace_loc}/lib/IQmathLib"

Both of these options will proper reference the desired folder and will allow the compiler to find any resources located there during the build process. However, these two search paths are different. The first option uses an absolute reference. This is an explicit file path that names every step and every folder along the way to the specified folder. This option will work but is a very inflexible way to specify a search path. If any folders along the file path is renamed or if any path from the storage device name to the final file location is changed, then this setup will no longer work. A more practical example of how this search path can cause problems is in the case when you are working with a team and your project needs to be ported to a co worker’s computer. In such a case, your coworker may not have their file system setup the same way your system is setup, and in this case, the project will fail during build right out of the box. This can lead to a lot of wasted time trying to figure out what the problem is as this issue isn’t the most readily obvious problem to solve.

The second search path is a relative search path. Instead of defining the entire file path to the target folder, it instead starts the file path at a variable location, int his case ‘workspace_loc.’ Starting from this location, the file system will than go to the lib folder and then the IQmathLib folder. This method of defining a file path is much more flexible than an absolute file path as the workspace_loc variable location is defining uniquely for each computer setup. If the project is taken from one computer to another, then this relative file path will use the new computer’s definition for workspace_loc. In this manner, even if the workspace is in a different location, relative file path will not cause any issues.

As another hint, the file location for file path variables like workspace_loc can also be defined. The screen below shows how these definitions can be set.