Portability
From APIDesign
Line 1: | Line 1: | ||
When designing frameworks and libraries that shall be widely adopted it is important to increase [[portability]] as much as possible. If an [[API]] can be used on different systems, different configurations, the amount of users including such [[API]] in their applications grows. | When designing frameworks and libraries that shall be widely adopted it is important to increase [[portability]] as much as possible. If an [[API]] can be used on different systems, different configurations, the amount of users including such [[API]] in their applications grows. | ||
+ | |||
+ | The best way to hurt [[portability]] is to depend on a 3rd party [[API]] that isn't [[portability|portable]]. Depending on Win32 [[API]] is one such example. Of course, writing in [[Java]] (a [[language]] designed to ''write once and run everywhere'') greatly increases portability. However there is another axis hurting [[portability]] - the support JDK version. Of course, should a library be widely used, it has to support as oldest JDK as possible. These days it is [[JDK]]8 - the primary reason being that [[Android]] supports [[JDK]]8 - as such, should a library be used on [[Android]] (as well as regular [[Java]]), it needs to stick to version eight. Btw. not that many years ago, | ||
Revision as of 15:11, 29 October 2022
When designing frameworks and libraries that shall be widely adopted it is important to increase portability as much as possible. If an API can be used on different systems, different configurations, the amount of users including such API in their applications grows.
The best way to hurt portability is to depend on a 3rd party API that isn't portable. Depending on Win32 API is one such example. Of course, writing in Java (a language designed to write once and run everywhere) greatly increases portability. However there is another axis hurting portability - the support JDK version. Of course, should a library be widely used, it has to support as oldest JDK as possible. These days it is JDK8 - the primary reason being that Android supports JDK8 - as such, should a library be used on Android (as well as regular Java), it needs to stick to version eight. Btw. not that many years ago,
Of course, writing portable libraries is harder. It requires more work from the API author, more self-control, more suffering. However such suffering is justifiable. There is usually a single API writer, but there are many users to it. What matters is to simplify and improve experience of those API users - own author suffering doesn't matter that much.
On the other hand, there is no need to suffer needlessly. Even API writers shall have a decent life! What does that mean in Java? While an API writer wants to target the oldest JDK possible, there is no point in sticking with ancient Java syntax! Just use Frgaal!
Frgaal is the Java compiler for framework and library authors!