Блог пользователя Siriuslight

Автор Siriuslight, история, 7 лет назад, По-английски

I think some will agree with my opinions and some might feel it is not necessary in Competitive Programming. But, I feel that programming is not just about writing a correct a code that solves the purpose, but also how the code looks.

Everyone have their own style of writing codes. One of the persons whom I admire the most is rajat1603(Rajat De). Rajat's codes are very well formatted and obviously they are correct. I think the people who are learning from reading other's code get benefited from these beautiful codes a lot. I personally feel very happy after seeing Rajat's code. There are also various other coders who code beautifully like our legendary champion tourist(Gennady Korotkevich).

I just want to advice everyone to write your codes like its your personal signature, follow your own style and maintain a symmetry. Try it, feels good. I am not a very good problem solver neither a good blogger. I just love beautiful codes.

Please give suggestions, how this can be encouraged.

  • Extra points can be awarded if possible during contests.
  • A new rating like contribution and contests rating for code beauty.
  • Проголосовать: нравится
  • -16
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Siriuslight (previous revision, new revision, compare).

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Siriuslight (previous revision, new revision, compare).

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Siriuslight (previous revision, new revision, compare).

»
7 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

I don't think that codes' beauty is necessary in Competitive Programming. Because in Competitive Programming, your code is written for yourself to understand, instead of other readers. So you can just write in the way that you can understand. And that's totally enough.

Another reason why our codes (maybe) are not well formatted is that, the length of a contest is rather short. If we spend a lot of time on doing these things, I don't think it's a wise decision.

So that's why I'm not for building such a (maybe) useless system. Maybe where codes' beauty is really useful is doing a big project which may contain a lot of functions and something like that.

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Personally I learn from reading other's codes. I have read various people's codes. It is easy for me to read proper formatted code.

    • »
      »
      »
      7 лет назад, # ^ |
      Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

      Yeah I understand what you mean. But what I want to say is that, it's really unworthy for coders to spend large amounts of time writing notes and formatting their codes. If there is such a system, maybe lots of people may just concern on how to make their codes easy to read, instead of how to do problems, which is of course not good for improving their programming ability.

      PS: Another problem is that, how can the system judge whether the code is beautiful? The formatting can be done with the help of AStyle. Also how to differ notes that is useful from those meaningless ones?

      • »
        »
        »
        »
        6 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Yes, I think deep_learning has a valid point. There is no such way to identify the useful notes/Comments among the redundant/useless notes. Also, it won't be wise to write code in a beautiful manner. I think Code is poetry and it is not to be meant to be understood by everyone without a little effort from their side.

»
7 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

I think that something like contribution points is actually a nice idea. Not as a motivation, but if other people read some code and found it useful then I'd like to know that when I'm looking for a clear implementation of this particular task.

I wouldn't hope to see this implemented on codeforces though. With so huge platform, there are more important problems than this. I think this might be a nice suggestion to the smaller competition sites. For example I have noticed that csacademy is introducing many novel features that no other sites do. Also, you may consider making by yourself an external site for rating cf codes. I'd be happy to check it out.

I definitely don't agree with adding code looks to competition rules. I bet there are other coding-related sites where code looks matter, but competitive programming focuses on something else.

»
7 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

IMHO, the code reflects your personality. Just like your handwriting.

Of course, it is always better to write well formatted code. But when you are competing against the time and other people, that choice may be second priority.

On the other hand, if we will go as far as giving points for the way the code is written, it may be the case for university assignments / projects but not in a competitive programming environment.

I also like the way JoeyWheeler writes his code!