Ad
  • Default User Avatar

    The problem is somewhere else but I have no way of knowing where

  • Custom User Avatar

    Thank you, I´ll look at it :) Although I think I understand the visibility and accsess modifiers in Java, I just didn´t know it´s possible to declare more classes in one file and the rules around that.

  • Custom User Avatar

    If you need more info about various visibilities in Java
    https://iq.opengenus.org/public-private-protected-in-java/

  • Custom User Avatar

    Interesting. Thanks for sharing!

  • Custom User Avatar

    So the solution was just to remove the public modifier :) Well, at least I´ve learned something new about java.

  • Custom User Avatar

    Thanks for your suggestion. It would be quite strange solution for java... but I´m gonna try it.

  • Custom User Avatar

    I don't know much about java, but I think the only way is to declare those classes private inside the main class (Leetspeek class in this case).

  • Custom User Avatar

    ./src/main/java/Leetspeak.java:31: error: class Encoder is public, should be declared in a file named Encoder.java
    public abstract class Encoder {
    ^
    ./src/main/java/Leetspeak.java:35: error: interface Dictionary is public, should be declared in a file named Dictionary.java
    public interface Dictionary extends Map<String, String> {
    ^
    ./src/main/java/Leetspeak.java:39: error: class LeetspeakDictionary is public, should be declared in a file named LeetspeakDictionary.java
    public class LeetspeakDictionary implements Dictionary {
    ^
    3 errors

    I really tried to make an OOP exercise out of this kata. And of course, in my IDE every class has its own file. But how am I supposed to submit my result here correctly?

  • Default User Avatar

    The escaping characters and the null parameter made it tough for me. Nice task though!

  • Custom User Avatar

    If the translation is that bad (which happens quite often with Java->Kotlin translations), it must be improved or not even accepted.
    Is there a process to give better translations?

  • Custom User Avatar

    And that's definitely why this Kata is marked as 6kyu

  • Custom User Avatar

    I gotta say, having to deal with some abstract class is just a distraction that takes away time from the actual task and I can't see any benefits of it. I'd like to also echo @ChristianECooper's comment from 5years ago.

  • Custom User Avatar

    The Kata was designed for Java and was translated by community to Kotlin, that's why some constraints seem illogic when coded in Kotlin.

  • Custom User Avatar

    Really, this is one of the worst Katas, at least for Kotlin, I've stumbled upon.

    These Katas should train people to code properly, it is extremely important to me that the code presented is already on a very good level.

    Why on earth must Leetspeak be derived from this abstract Encoder class? Makes no sense and is not given by the setup and only fails the hidden tests.
    Why on earth do you do encode on a nullable string and expect that to return an empty string? This is Kotlin! Use the power to make clean interfaces!
    Why on earth do you write a test with assertTrue and then put a comparison in the actual part? Use assertEquals!

    Really, had no fun doing this one. The expected code is very simple, but the setup is really bad. Wish I could at least fix the issues in the Kotlin translation.

  • Default User Avatar

    At the beginning the class Leetspeak is declared as an independent class instead of being an inheritor of Encoder. Just "extends" is needed.

  • Loading more items...