+ 7

Please, comment your codes!

I saw a lot of really nice projects so far 😊. But what many of you have in common is that you don't comment your codes properly or not at all😢. And to be honest: Your code is, in parts, almost useless in terms of sharing and even to yourselves when you don't explain what you are doing (even though the output might be nice). Poeple who try to learn about the workings of your code (and even you!), have it very difficult to understand what you are doing. And this applies to learners and even experts.

3rd Jun 2017, 12:29 PM
MMK
MMK - avatar
5 Respostas
+ 7
A little guide line (did not fit into original post): 1. Write preambles to your codes. 2. Subdivide your code into sections describing its purpose, e.g.: Sorting algorithm 2, then add a description of how this algorithm works. 3. Comment sections of your code (like functions and classes and what they are for) 4.. Comment single lines which are doing sth. special. Like a special command you found. The first occurrence is enough 😊 5. Generally document what your code does. This will also help you immensely while developing your code. You can move from one section to another and navigate your code more efficiently. And when you take longer breaks from developing on a certain project, it is much easier to get right back into it. Furthermore, you can go back to old codes for a certain useful code snippet to use it somewhere else. And when someone is looking for a certain code snippet or function, they will find it faster (or even at all) in your code and will more likely leave a like 😉
3rd Jun 2017, 12:35 PM
MMK
MMK - avatar
+ 7
(Absolutely I don't know what had I done/write in my own code)
3rd Jun 2017, 12:35 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 5
You are absolutely right. Comments and code presentation play major role in improving the quality and readability
3rd Jun 2017, 12:46 PM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 3
Please also follow the following post https://www.sololearn.com/Discuss/333768/?ref=app
3rd Jun 2017, 2:34 PM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 3
I always leave comments when I feel that may turn out to be educative for others. Some of my codes are specifically devoted to education - the whole [PythonEdu] series for example.
3rd Jun 2017, 9:01 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar