4 kyu

1337 Classes

Description
Loading description...
Metaprogramming
Object-oriented Programming
  • Please sign in or sign up to leave a comment.
  • trashy_incel Avatar

    Python translation (author gone)

  • user9644768 Avatar

    Ruby 3.0 should be enabled, check details here and here.

    And if possible update the github list.

  • ice1000 Avatar

    Learned a lot about ruby metaprogramming, thx.

  • macobo Avatar

    Fun task, thanks.

    A single nitpick would be that the description could be improved: I understood the task that in addition to doing what needed to be done, each instance should have a unique_class_method and unique_instance_method methods which return the real (unique) methods accordingly.

  • kazk Avatar

    Approved with the average 4 kyu. Added few tests to assert not equal, as suggested by @danielpclark below.

  • danielpclark Avatar

    I suggest you use some test cases besides assert_equals. Unless you intended for 1337 as in "leet" solutions you will have people passing your tests without solving your problem. Try having atleast one assert_not_eqauls and one expect_error.

  • mlabrum Avatar

    I suggest adding clarification that the class and method names as well as the return values can be whatever the person wants, so long as they are unique amongst the classes. From the example in the description, I assumed the specific names and values would be tested and so thought I had to make sure the class names were "Klass_" followed by an integer (starting at 0), the class methods needed to be named "unique_class_method", the instance methods needed to be named "unique_instance_method", and the return values needed to "c" or "i" followed by the same integer as in the class name.

    I think the example needs to be updated to be one that would pass the new test cases. Specifically, the example has "unique_class_method" and "unique_instance_method" as the class and instance methods for both Klass_0 and Klass_1.

    Besides that, I like this kata. It's an interesting problem to dynamically create classes and methods.