8
\$\begingroup\$

Just a question regarding answering with a library.

Function that adds two integer strings question is basically a home made algorithm for parsing and adding to arbitrarily large strings with integers together.

Should you answer as you would/should do in real life? (Use existing libraries) or should you always answer as if the code in the question is the correct way to do it, and improve on it? May be rephrased as:

Should you answer and review the intent of the question, or the actual code?

My answer is: https://codereview.stackexchange.com/a/99088/15532 and even though it might be obvious for some I argue that some people might not be aware of BigInteger and the set of answers is more complete with this answer as well.

\$\endgroup\$

1 Answer 1

14
\$\begingroup\$

IMHO your answer is valid, but often posters want to reinvent the wheel to check if they can do it and to improve their coding skills.

Usually there should be used the tag which is created exactly for that purpose. If you browse this tag, you will see a lot of questions where one would normally aks, why didn't you use class X or library Y.

Also the comment on your answer mentioned the part about the .NET version which is legit too.

That being said, an answer stating that the same could be achieved using some class or library is a valid answer and also could be seen as sufficient for the question.

\$\endgroup\$
3
  • 3
    \$\begingroup\$ This. I always try to do both when someone is reinventing the wheel. (Assuming they didn't explicitly say they are already aware of X library.) \$\endgroup\$
    – RubberDuck
    Aug 5, 2015 at 11:30
  • \$\begingroup\$ Yes very common to reinvent for learning purposes, that I understand and do myself as well. Wouldn't have answered if they said they were aware of feature X. Thanks for the tag reference, will keep that in mind. @RubberDuck I didn't do both, because others had provided good reviews already. \$\endgroup\$ Aug 5, 2015 at 14:39
  • \$\begingroup\$ If no such tag is applied, things get more complicated. \$\endgroup\$
    – Mast Mod
    Aug 18, 2015 at 10:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .