Re:When to use generics
by zarzavat on Wednesday April 13, 2022 @05:34AM
(#31012693)
You should start with the most difficult (non-obvious) part first.
If the most difficult part of the problem is the algorithm, then start with that and figure out the types along the way.
If the most difficult part are the types / data representation then start with that and worry about the algorithms later.
If both are difficult, then they need to be considered together and come up with a holistic solution. These are the kinds of problems that often take a two or more rewrites before you come up with something you're happy with.
If the most difficult part of the problem is the algorithm, then start with that and figure out the types along the way.
If the most difficult part are the types / data representation then start with that and worry about the algorithms later.
If both are difficult, then they need to be considered together and come up with a holistic solution. These are the kinds of problems that often take a two or more rewrites before you come up with something you're happy with.