Design Pattern 裡面有一個Strategy pattern,他的特性如下:
In computer programming, the strategy pattern (also known as the policy pattern) is a software design pattern that enables an algorithm's behavior to be selected at runtime. The strategy pattern
1. defines a family of algorithms,
2. encapsulates each algorithm, and
3. makes the algorithms interchangeable within that family.
載入 native library 的時機點也是在 runtime,剛好符合 Startegy pattern 的 case:
載入 native library 的時機點也是在 runtime,剛好符合 Startegy pattern 的 case:
例子如下: