logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

Portability-matters.md (3468B)


  1. ---
  2. date: 2017-11-13
  3. layout: post
  4. title: Portability matters
  5. tags: [portability, philosophy]
  6. ---
  7. There are many kinds of "portability" in software. Portability refers to the
  8. relative ease of "porting" a piece of software to another system. That
  9. platform might be another operating system, another CPU architecture, another
  10. web browser, another filesystem... and so on. More portable software uses the
  11. limited subset of interfaces that are common between systems, and less portable
  12. software leverages interfaces specific to a particular system.
  13. Some people think that portability isn't very important, or don't understand the
  14. degree to which it's important. Some people might call their software portable
  15. if it works on Windows and macOS - they're wrong. They might call their software
  16. portable if it works on Windows, macOS, and Linux - but they're wrong, too.
  17. Supporting multiple systems does not necessarily make your software portable.
  18. What makes your software portable is *standards*.
  19. The most important standard for software portability is POSIX, or the **Portable
  20. Operating System Interface**. Significant subsets of this standard are supported
  21. by many, many operating systems, including:
  22. - Linux
  23. - *BSD
  24. - macOS
  25. - Minix
  26. - Solaris
  27. - BeOS
  28. - Haiku
  29. - AIX
  30. I [could go
  31. on](https://en.wikipedia.org/wiki/POSIX#POSIX-oriented_operating_systems).
  32. Through these operating systems, you're able to run POSIX compatible code on a
  33. large number of CPU architectures as well, such as:
  34. - i386
  35. - amd64
  36. - ARM
  37. - MIPS
  38. - PowerPC
  39. - sparc
  40. - ia64
  41. - VAX
  42. Again, I could go on. Here's the point: by supporting POSIX, your software runs
  43. on basically every system. *That's* what it means to be portable - standards.
  44. So why is it important to support POSIX?
  45. First of all, if you use POSIX then your software runs on just about anything,
  46. so lots of users will be available to you and it will work in a variety of
  47. situations. You get lots of platforms for free (or at least cheap). But more
  48. importantly, *new platforms* get your software for free, too.
  49. The current market leaders are not the end-all-be-all of operating system
  50. design - far from it. What they have in their advantage is working well enough
  51. and being incubent. Windows, Linux, and macOS are still popular for the same
  52. reason that legislator you don't like keeps getting elected! However, new
  53. operating systems have a fighting chance thanks to POSIX. All you have to do to
  54. make your OS viable is implement POSIX and you will immediately open up
  55. hundreds, if not thousands, of potential applications. Portability is important
  56. for innovation.
  57. The same applies to other kinds of portability. Limiting yourself to standard
  58. browser features gives new browsers a chance. Implementing standard networking
  59. protocols allows you to interop with other platforms. I'd argue that failing to
  60. do this is *unethical* - it's just another form of vendor lock-in. This is why
  61. Windows does not support POSIX.
  62. This is also why I question niche programming languages like Rust when they
  63. claim to be suited to systems programming or even kernel development. That's
  64. simply not true when they only run on a small handful of operating systems and
  65. CPU architectures. C runs on *literally* everything.
  66. In conclusion: use standard interfaces for your software. That guy who wants to
  67. bring new life to that old VAX will thank you. The authors of
  68. [servo](https://servo.org/) thank you. *You* will thank you when your
  69. circumstances change in 5 years.