#Request Generic Function Handlers

1 messages · Page 1 of 1 (latest)

mint lichen
#

the need to comment the obligatory "why would you do that? notlikethis56px" is strong

#

the generics are lost on two levels: you could leverage T much more, but it's also redundant with the Entity enum and the switching

#

not just redundant, actively conflicting

#

technically, it might be possible to use a generic method for all kinds of entities as long as the function behaves exactly the same for each type

#

if there's the tiniest difference, the whole experiment is pointless

modern oasis
#

Hi @mint lichen thanks for the reply!

Yes i am 100% completely agree with you. When I look at the codes and try to refactor it, It came through my mind that what happened if I have so many API endpoints that each of it might need its own handling function. And then I look the routes.get() function which is I think is generic? Instead of having new function for every route, we just need to call 1 function which is the routes.get().

So in my thinking, I am trying to achieve the same behaviour.