|
... the experienced developers are generally producing better code, mostly because the tools (IDE, languages, frameworks) allow them to concentrate on the task instead of the lower level mechanics.
But ... the inexperienced are producing worse code, mostly because the tools (IDE, languages, frameworks) allow them to concentrate on the task instead of the lower level mechanics! And if you don't know how to do it, copy'n'paste random code from SO and wonder why your C++ compiler doesn't like PHP ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
From newbs, young experts, old farts... I still see
* code not indented
* code not commented
** stupid comments that describe the line of code and not its significance
* unneeded global variables
* unchecked return values
* other language-specific blunders
Nothing changed, except that there are many more "toy block tools" that further confuse things,
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
You're working too much!
If those globals aren't needed, delete them and see what happens!
|
|
|
|
|
When I can refactor the code, sometimes I do exactly this. You'd be surprised (probably not) on how many global symbols are declared and never used, or used once in a function (because static variables are forbidden knowledge).
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
I'd been writing C++ for years before using and then appreciating static variables in functions.
|
|
|
|
|
I usually avoid them unless I'm writing firmware (often stack size is measured in bytes so statics are used instead of local variables) because in my experience module variables are usually the best solution when statics are needed - they are more easily observable and they can be modified by other functions/methods.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
It even took me longer to realize that module variables are often a good replacement for static class data! I've got a pile of them to move, but my C++ tool now flags them and I'm working toward it being able to do the edits automatically.
|
|
|
|
|
Add to your list:
* Poorly organized code.
* Executable code in C/C++ header files.
* Vague structure names like xx_
* One of my !favorites "if ( 1 == A ) "
* Unclear/non-descriptive function names
* One line functions e.g., AplusB (int a, int b { return a + b; }
|
|
|
|