Bad Coding Style | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Bad Coding Style

Why does Sololearn teach a horrible coding style, like the worst possible? Examples in the Challenges like "what is x-++--y" are teaching the opposite of what real code should do. In real live applications it is very important, to write code in a way, that is explicit to understand. Pre and postincrementors (++x and x++) should never be used in a way where they can confuse the reader. Also in many cases it is just WRONG (in terms of the C++-Standard "undefined behaviour") to use them inline. Example: void f(int a, int b) { std::cout << a << ";" << b; } call with f(x++,++x); It is not defined in the standard, and can differ between compilers, which values are printed. (For everybody who wants to read upon it: http://en.cppreference.com/w/cpp/language/eval_order) So please for everybody - do not take the code you see on Sololearn as any kind of reference how Programming looks. It is a nice mind-challenging game, but it is by all means not a place to learn "real" coding. If you want to learn coding - start with any kind of project, start with reimplementing facebook, your favourite games or any others, just produce code of any kind. And then you learn the hard way, why there are things like "Code Styles", "Commentary", "better explicit than implicit", and so many more pitfalls you encounter while coding. EDIT: Just for clarification - I work in the software industry, I know a little bit of the game. And yes - in professional environments there also several black sheep. But it always depends on the requirements for the project - you cannot build software that is intended for safety cases with crappy software style, and you cannot create software that is intended for high productive use with a crappy software style. But indeed you can build crappy software with a crappy software style (M$ is a very good example for baad and crappy software style)

18th Dec 2016, 8:15 PM
John Doe
John Doe - avatar
1 Answer
+ 1
It is true that many parts of programming language are not necessary to learn. In an ideal world, codes are written following proper convention, and structure. But that is ideal. If you read most of the codes, they are so horribly written. No documentation, unnecessary syntax, and on and on. Maybe if you make all your project yourself and don't like to collaborate you'll never come across it. But for everyone else, it is important to know.
18th Dec 2016, 8:09 PM
Rishi Anand
Rishi Anand - avatar