There is a project I’m about to build in Smalltalk (Pharo). And there is a python library which I intend to use for the same. Now, there are 3 options:
- Smalltalk wrapper for those python libraries
- Porting the python library to Smalltalk
- Write the library from scratch (in Smalltalk) for use in my project
The following are my queries:
- What are ‘basic’ differences in porting/wrapping (No satisfactory explanation found anywhere yet)
- How to know when to use which (of all the three)?
- Any resources or pointers where I can get further help/some kick-start into my project.
Thanks!
Wrapper
Write functions in the native language whose sole purpose is to call the functions in the external library. The goal is to do as little as possible in the native language. For example, translating data types from the native language to the external library language, etc.
Wrappers make sense when the external library is:
Porting
A port is simply a translation from one language to another. In general, the same logic is maintained as much as possible.
Porting makes sense when:
Re-Write
Think of a Re-Write as a Port with a lot of refactoring. The goal is to take advantage of features of the native language to improve the library in some way (efficiency, readability, etc.)
Re-Writing makes sense in all of the same scenarios as porting. Deciding whether to do a simple port or a full re-write usually comes down to one question: