bio-oracle / biooracler

R package to access Bio-Oracle data via ERDDAP
Other
8 stars 2 forks source link

Change function names to include namespace #10

Open salvafern opened 1 year ago

salvafern commented 1 year ago

There are only two hard things in computer science: cache invalidation and naming things.

Following the famous quote of Phil Karlton I would like to argue about changing the names of the functions. Main intention is to keep it as sync as possible with the pyhton extension pyo_oracle. So we got:

R

biooracler::list_layers()
biooracler::download_dataset()

Python

pyo_oracle.list_layers()
pyo_oracle.download_dataset()

Which in principle would be fine. However, as you may know these are also function names used in sdmpredictors, and by design the R functions will overlap as there is no need to call the namespace in the functions after loading a package.

library(sdmpredictors)
library(biooracler)

# ??? Which one?
list_layers()

One solution

A way to surpass this problem is to add a prefix to the functions that makes them unique. This is widely used within the R community. E.g.

bo_list_layers()

This means that the names of the methods of both the R and python extensions will be slightly different. However, I believe it will make biooracler easier to use and less confusing.

On the other hand, sdmpredictors and biooracler should eventually become one single package, as they have a very similar purpose and they differ mainly in the back-end.

But I would like to discuss this publicly and you may have better arguments. Looking forward to see what you think!