knot126 / Melon

Foxy library that does everything* and tastes good
Other
1 stars 0 forks source link

Decide on how to handle multipule algorithms for solving one task #13

Closed knot126 closed 1 year ago

knot126 commented 1 year ago

Often in Melon we actually implement more than one algorithm for solving a task, but it only sometimes makes sense to provide a default interface. For example, with something like encryption, it would probably make more sense to have no default since algorithm you choose is inheritly tied to the output and it needs to use the same algorithm again, otherwise things break.

But for an insecure pseudo random number generator, you don't tend to care what algorithm it uses, you just want a random number. The number is just supposed to be one of any set of numbers, you don't really care what comes next. Of coruse, if we are using secure random number algorithms then it does actually matter...

The core of the issue: We currently have no default way of handling more than one algorithm, especially when it comes to naming schemes and if the functions for these algorithms should be exposed directly or hidden behind a main function.

I think the best way of handling it is seen in hash.c; you have DgHashUInt32_AlgoName(), and things are exposed directly to the public.