New Category for Coding: Clean Code

Writing code with less characters as possible seems fun maybe, but the readability is mostly very bad. So, how about Clash category where you have to write clean code which is easy to read and easy to understand. Every clasher in the lobby, who finished with coding has to share or show the code and the others in the lobby have to review and judge the code for its readability, after they finished with coding too.

Let’s not forget that the winner will be awarded a lifetime license for Rational Doors as well as a awesome “QUALITY makes no sense without U and I” t-shirt. :older_man:

Thanks, very useful and constructive.

The problem I see with it is that you have no objective way to evaluate it, and relying on other other inputs is for me not a reliable way of evaluation here where there is a context of competition.
How would you prevent “bombing” of users ?

4 Likes

There are ways to evaluate objectively. For example the names of variables. The name “X” for a variable says nothing much. But if you call it for example “CircleDiameter” then it is clear what the variable stores. Strings get called mostly “s”. But what does it store? Which information? A name? A adress? A Charset?

There is a book from Robert C. Martin also called “Uncle Bob” with the title “Clean Code”. It contains ways on how to write more readable code. But you don’t have to read the book because on the internet you find these ways to on how too on how write such code. And even if you don’t know how to objectively evaluate code from others or yours, there could be some sort of “cheat sheet” for the game mode which contains information on how to write clean code.

Do you mean with “bombing” rating code badly on purpose? If so, then yeah, this could be a problem. But how about making the creators of the codes anonymouse and after the rating reveal the names? This should prevent such acts.

I don’t do clash of code, but I see some weaknesses in such a format:

  • “I want to start the next clash and not rate other solutions, let’s just give everyone the same score”
  • “I don’t understand that language, so it’s not readable to me”
  • voting for friends (you can still know from whom you vote when you use the chat)
  • how does a good solution look like? Even if you give guidelines, most people won’t read it (clash of code is just for fun, with long rules it would turn into work)
5 Likes

I admit my defeat…

1 Like

When I said “objective”, I should have said “easily automated”, my bad.
So far, the system to evaluate your solution is simple : validators work or not. Can add character count, it’s easy. Evaluating clean code is another level of automation.

As for bombing, I did not think of that simple solution, even though it could be worked around with chat as mentioned bu someone else.

I had not even thought of it as a category for clash of code, where people would not want to stay.

I think in general, clean solutions might get upvoted in the training category, but it’s not a good metric either (I personnaly won’t look at all solutions, usually only a few from the best rated to see how mine could have been improved, written more elegantly, or something)

Maybe some members could have the opportunity to rate it as a “good” solution, because they can back some good knowledge of language, to promote one solution and put forward clean code, but I don’t see it as a competition category

Okay, maybe “Clean Code” not as a new category, but as an optional feedback for the coders. You can review the code of others only if you submitted your own code and make it visible so that your code can be reviewed, too. So that could maybe reduce rating others code badly on purpose.

But then perhaps it could be that the coder feels attacked because of the bad feedback he got, even if the review is objectively right in relation to clean code.

One problem I have with short codes in clashes is that they mostly written in one line and almost no spaces between. I can’t read such code but I would like to do but then you had to add space, tabulator or/and format the code so that is readable. But if you add these you will lose eventually. So one solution could be to ignore spaces, comments and tabulators to prevent one liner and provide better readability of the code. Here a link to a already existing topic in context to improving the short code clash: https://www.codingame.com/forum/t/clash-of-code-shortest-improvement/2765/4

Honestly, I get a little upset when I do Clash of Code and the winning condition is not just to write code that works but write short code. With Pascal you don’t really have a chance because you have to declare variables and use keywords such as “program”, “begin” or"end". I bet in some other programming languages you have some problems, too.

Of course I could learn Python, Ruby, JavaScript or Bash. Especially Bash because I was amazed by the fact that you need maybe around 10 characters to write a code that replaces one character in a string with another. I think it was the puzzle with the bad teeth and you had to replace the bad teeth “0” with “-”.

But I was also mad when I realised that I can’t provide short enough code to acutally win in this category. Maybe it is time to learn a new programming language. I mean it is some kind of motivation for me but maybe a wrong one.