Programs, scripts or procedures that work the same way regardless of the underlying operating system.
In work, open source and pet projects sometimes we need to make programs, scripts and/or procedures work regardless of the underlying operating systems and/or libraries. Some examples of differences that should be overcome are:
- path separator character (
\
in Windows,/
in Unix derivatives); - availability of certain command line tools;
- need/desire to use a native functionality for a given task (for example for better performance).
At a high level, these problems can be solved in the following ways:
- by using functionalities that abstracts these differences;
- by testing directly the presence of a feature. An example of this is Javascript feature detection;
- by detecting the environment and act differently according to the detected environment. An example of this is documented by Martin Fowler in his article about Rake (in particular see the section about the use native XSLT engines).