Bad Programming Habits? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 20

Bad Programming Habits?

7th Mar 2017, 6:00 PM
Fake Mask
35 Answers
+ 71
Search for 'clean code' on Google. That will lead you to Uncle Bob. He wrote down, what dirty code is and how to avoid it. It's just too much to write it down here, but some of the most famous principles are: - KISS (keep it simple, stupid) - DRY (don't repeat yourself) - MAYA (most advanced yet acceptable) - convention over configuration
7th Mar 2017, 7:03 PM
Tashi N
Tashi N - avatar
+ 46
- Using var instead of explicit data types. - Using static instead of access modifiers like public/private. - Using public for class data members. - Placing a } on the same line as code. - Not indenting your code. - Placing multiple code statements on 1 line. - Importing unneeded packages/files/classes. - Poorly naming identifiers for variables, methods, and/or classes. - Not being consistent with your conventions. - Not following the language's conventions, and the conventions you follow yourself or for the place you work for. - Not using comments. - Stealing others' work without credit/permission. - Providing poor prompts for user input. The list goes on and on, but that's what I thought of off the top of my head. :3
7th Mar 2017, 6:47 PM
Tamra
Tamra - avatar
+ 26
a progrmmer must know this sites: stackoverflow.com github.com
9th Mar 2017, 11:06 PM
Nima Mohamadian
Nima Mohamadian - avatar
+ 19
not practicing much
7th Mar 2017, 7:15 PM
POJO
POJO - avatar
+ 18
PYTHON!!! if not import this: print(dirty code)
12th Mar 2017, 10:11 PM
Gami
Gami - avatar
+ 16
To be clear: luka is right somehow, because that question has been asked a lot of times before here at Q&A and I could easily find the other posts. And it is never a good idea to be rude to someone only because he takes a different opinion. You don't have to agree, but please don't attack someone personally. We want to discuss here, not fight.
10th Mar 2017, 2:22 PM
Tashi N
Tashi N - avatar
+ 13
worst programming habit is to write a code in such a way that even you can not understand it in future
10th Mar 2017, 11:24 AM
Anurag Singhal
Anurag Singhal - avatar
+ 13
@Surya Yes, readability is really important. But IDEs manage that.
11th Mar 2017, 1:17 AM
Tashi N
Tashi N - avatar
+ 9
poor comment, poor naming //this is a stream function myFunc() { //code }
10th Mar 2017, 5:51 AM
Yuliana
Yuliana - avatar
+ 9
There is something that i think it is essential, most of the time ppl tend to forget about it and we only regret it when we visit the code a few months later, which is comment the code. Specially the logic behind some lines of code, or the use of a tricky variable!
10th Mar 2017, 1:31 PM
Pedro Mendonça
Pedro Mendonça - avatar
+ 8
TO GIVE UP
10th Mar 2017, 5:48 PM
Meharban Singh
Meharban Singh - avatar
+ 8
Just 1-> Lack of practice... Trust me bro coding is fun and once it execute correctly, its the biggest happy and satisfying thing for the geek....
12th Mar 2017, 7:31 AM
Junaid Ashraf
Junaid Ashraf - avatar
+ 7
this is not one of them it is a newb question but not retarted.
7th Mar 2017, 6:24 PM
david schlemmer
david schlemmer - avatar
+ 7
Most people do not follow the indentation. Take this example: void func() { if(...) {cout<<"Example"; int a++;} else(...){ int a--; }} The above example is not easy to understand at the very first glance but now look at this: void func() { if(...) { cout<<"Example"; int a++; } else(...) { int a--; } } This is how indentation helps. This makes the program more easier to understand, not just for you but to the others who see it. But most of them fail to follow this.
11th Mar 2017, 1:14 AM
Surya Vamsi
Surya Vamsi - avatar
+ 7
Reviewing your code after you write it for comments and optimal solution will result in clean and efficient code.I believe peer review can help a lot .
11th Mar 2017, 3:29 AM
Pooja Jangid
+ 6
@Tashi explained that it has been asked lots of time. In itself it is not a bad question.
10th Mar 2017, 2:43 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 6
less practice
11th Mar 2017, 4:36 AM
Amar Dahake
+ 6
not writing comments, so when you come back later you are confused.
11th Mar 2017, 10:03 PM
Jacob Kucera
Jacob Kucera - avatar
+ 4
copy and paste
10th Mar 2017, 4:58 PM
M0rr1$0n
M0rr1$0n - avatar
+ 4
1) Not including semicolons at the end of statements ( especially in JavaScript ). 2) Only learning new things and features but not practicing to have a command on what we know. 3) Using too many variables. This will take up the space of the system. 4) Not properly using the loops.
11th Mar 2017, 9:49 AM
Shubham Agrawal
Shubham Agrawal - avatar