Draft

Very Simple Inheritance for Beginners

70 of 307Dana
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • user9644768 Avatar

    Please use new python test framework.

  • jeffwright13 Avatar

    For Python, the example code in the Instructions tab is not properly indented, and results in IndentationError being thrown if executed as-is.

  • RobertBurek Avatar

    handle the division by zero error

  • ymer94 Avatar

    First of all, you should not access the result variable dirctly by having it public but instead use a private variable with a get method which only returns the value of the result variable, espacially when working with inheritence.

    Secondly, I saw that you named the result variable as Result with a capitalized R instead of using all lowercase as in the other languages. I missed that while reading the description and used the C# variable name while trying to solve it in Java which of course resulted in an error. I can't see a strong argument for not having the same variable names between languages so that is something I think should be corrected.

    If you think I'm wrong on any point please let me know why, it's always fun to learn something new.

    Otherwise I think this was a great introduction to inheritance at least for Java (as that is the language I'm most familiar with and have taken a few courses in), so thanks for that.

  • fxrbfg Avatar

    You will teach people to bad things with this kata, having classes doesn't meaning have oop. Remove public variable result and make method that execute operation return result directly. Correct signature of this method will be "double execute(double one, double another);

  • kmactavish Avatar

    No explicit sample tests showing why they shouldn't just be separate classes that don't share the Operation base.

  • alm8735 Avatar

    It does not make sense that division by 0 should result in 0 - in fact, in mathematical terms it could result in any number up to infinity. I think you should not test for division by 0, or at least have an error be saved in the result variable, e.g. 'Zero Division'

  • thomas.mitchell Avatar

    Nice kata, but I don't think the division operation should result in 0.0 when encountering a divide by zero error. None would make more sense to me.

  • TheMasquerader Avatar

    This kata was fun, but I think it should either be trimmed to just one operation implementation or made a little more interesting. As it is now, it's basically just repeating the same code four times.

  • demonation Avatar

    This comment has been hidden.

  • Joz Avatar

    Python translation added. Check please.

  • FrankK Avatar

    Hi Dana. Good beginner kata. I do have 2 remarks:

    1. 'm_Result' is not the industry standard,'Result' is better.
    2. I did not completely understand why you hide the base class. You can either add it in the code window or let the user create it. Because the test use an operation of type 'Operation' you are forced to create this base class anyway.