Ad
  • Default User Avatar

    I havn't been here for quite some time....this time I want to learn more about python while the last time I wanted to learn JS (solvinb Kata's by reading tutrials/books on the paradigms, techniques and languages themselves)

    The question is: what is the best solution?
    Overall I would say that the best solution in most languages is the one, that:

    • is best readable
    • has selfexplainatory variable names
    • does not contain multiple return statements (spaghetti)
    • is most explicit
    • as many constant values as possible

    While your argument about the run-times is def. valid I think this is not true for everything. If I remember my basic programming training correctly:
    Sacrificing above mentioned for a better runtime everywhere makes a project harder to maintain, as code is read far more often than written. Therefore code can and should be viewed as a form of written communication, where a good style is in balance between having it short and crisp while giving everybody the infotmation needed to understand what is going on (communicate to inform, not impress).

    When the project in the end has run-time issues, you should look for the bottlenecks and work on those. When I using this (great) platform to learn JS I saw many (in my opinion) badly written but high voted solutions, that used bad variable names (a, b, c, d) which are put there automatically during the minification process.

    Maybe the best practise voting system should be remodeled? ....a few thoughts on that could be (all standing for themselves while stacking should be possible)

    • weighted voting system
    • having different best practises: trivial/best readable/best runtime
    • having experts or the kata auhor give best practise on best readable/best runtime solution
    • grouping solutions and discussing them, tagging them (best readable/best runtime)
    • semi closed voting system for "experts"

    I am aware of the fact that most of what I have said might sond picky. But I am propably no exception in using this plattform to learn a programming language. While I have seen clean code (from other languages) I also know run time sensitive solutions and the necessity for both, wheras a total novice might not now the difference and is prone to learn a bad style.

    ...only my 10 pence of thought on the topic, no offence to anybody. I honestly like and adore this plattform and am thankful for the creators, developers and the work that was necessary to built it.

  • Default User Avatar

    I came across a couple top-voted solutions with run-times of O(n^2) or worse when even a O(n) solution exists to the given kata. Sure the linear solutions may be longer, but solutions with horrible run-times should not be promoted as "best practices".

    I don't know how to bring the upvoters' attention to run-time performance. But some general mechanism would be helpful to prevent people from converging on suboptimal solutions.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution