What's everyone take on using extension functions ...
# library-development
m
What's everyone take on using extension functions in libraries APIs?
Copy code
1. bitmap = Bitmap.fromFile(file, options)
2. bitmap = BitmapFactory.decodeFile(file, options)
3. bitmap = file.toBitmap(options)
Is there any of the above you prefer and why?
💰 1
a
As for the choise. If there is only one way to convert file to btimap and it is used quite broadly, then third option is good. If it is not that broadly used, then the option one is better since it does not polute
File
namespace.
Option two is useful only when there are a lot of different factories.
m
Nice, thanks for the article 👍👍