3 ms·
10 Real Signs You're a Crappy Programmer: 10. The exact same code is in multiple places because you didn't bother to put in into a common function. 9. You hav
by edw519 19y ago
10 Real Signs You're a Crappy Programmer:
10. The exact same code is in multiple places because you didn't bother to put in into a common function.
9. You have error codes in functions, but never bother to look at them (a sure sign that testing was never finished).
8. You have early exits from loops because you don't know how to properly code a recursion.
7. You execute too much code because you don't know the difference between "if" and "case".
6. You use 10 lines of code when 1 line would do because you don't know any better.
5. You need to run batch jobs from time to time to clean up your data base because you don't know how to debug well enough to find what's messing it up.
4. A third grader doesn't know what your variable names mean.
3. You think "Third Normal Form" is paperwork you need to fill out for one of your 8 bosses.
2. No programmer who has to maintain your code would ever want to work with you.
1. Any programmer that has to maintain your code would be more than happy to accept the consequences of first degree murder.
- omouse 19y ago0. You refuse to use recursion even when working with a language that supports it properly because you think it's horribly slow.
- boucher 19y ago"a language that supports it properly..." Meaning what exactly? A language that automatically optimized for tail recursion? Are there languages which don't support recursion "properly?"
- omouse 19y agoA few years ago my friend wrote up a few recursive functions in C and they were slower than using a for loop. Since then I haven't used any sort of recursion in C or C++. Maybe my fears are unfounded but I try and avoid those two languages in any case. edit: I just realized what I actually mean. Some programming languages, or the culture/community around them, do not seem to encourage certain things that can be done with the language. In the case of C/C++, while/do/for loops are used before recursion. In the case of Scheme, you try a recursive solution first and then go for a do-loop if you really need to...or something like that.
- dangph 19y ago> they were slower than using a for loop. Since then I haven't used any sort of recursion in C or C++. That's premature optimization.
- boucher 19y ago"8. You have early exits from loops because you don't know how to properly code a recursion." Wow. Not every problem calls for recursion. If you really hate early exits from loops, maybe you should just code the loop's condition differently.
- edw519 19y ago"If you really hate early exits from loops, maybe you should just code the loop's condition differently." Exactly. Like I mentioned before, I'm the poor schmuck that has to clean it up because someone didn't bother to take your (common sense) advice years ago.
- boucher 19y agoSometimes it makes more sense to bail early than it would to restructure. It could be that its more readable, or a more natural progression of things. Take this paper: http://www.csd.uwo.ca/~yuri/Papers/pami04.pdf http://www.csd.uwo.ca/~yuri/Papers/pami04.pdf It's really great, for the record. Anyway, the algorithm they wrote uses an early exit. In fact, they use a while(true), the "worst case" example. initialize: S = {s}, T = {t}, A = {s, t}, O = {(Empty Set)} while true grow S or T to find an augmenting path P from s to t if P = {(Empty Set)} terminate augment on P adopt orphans end while In programming this algorithm, sure, I could probably move the first grow before the loop, and grow at the end. But, now its harder to understand, and violates the afore mentioned copy paste rule. My point is this, take any such "rule" with a grain of salt. There are plenty of examples where it makes sense to do something atypical.
- Goladus 19y ago(6) Happens even when you know better. (10) Good programmers don't repeat themselves, true, and to continually improve as a programmer it is important to patiently do everything correctly the first time. However, obsessing over a few bits of code duplication is often a complete waste of time.
- edw519 19y ago"...obsessing over a few bits of code duplication is often a complete waste of time." For you, maybe. But what about the guy who applies enhancements 3 years later and has trouble getting through testing because the exact same code was somewhere else and difficult to find because of the 67 mods since then. Minutes "obsessing" today usually saves hours testing tomorrow.
- Goladus 19y ago"Minutes "obsessing" today usually saves hours testing tomorrow." True, but the app has to make it to tomorrow for testing to matter at all. It's better to be in the championship trying to figure out how to manage a tired team, than it is to conserve energy during the semifinals and wind up sitting in the bleachers.
- edw519 19y agoWhere'd you ever get the idea that there is any trade-off between "quick" and "right"? Doing things according to effective established principles saves a little time today and a lot of time tomorrow. Quick and dirty usually ends up being neither.
- Goladus 19y agoWhere'd you ever get the idea that there is any trade-off between "quick" and "right"? I don't have that idea. There is sometimes, though, a tradeoff between current needs and future needs; and that tradeoff can not always be predicted. When that happens, it's logical to give current demands priority. I can't for example, predict whether a future maintainer of my code would prefer code written with multiple returns, or code that sets temporary values, or code that uses a set of nested ifs, or code that assigns function pointers to a matrix and calls code based on the indices. Each technique has potential drawbackss in terms of future maintainability, likelihood of errors, and speed of immediate implementation. Trying to guess what a future coder (other than myself) will think is just not important in that case. Effective Principles can only be Established based on a given development environment, and it's the responsibility of those in charge of the environment to make sure the established principles are effective and followed by the developers.
- DanielBMarkham 19y agoI have to disagree with #6. You can either write code for the compiler or the human. I prefer to write it for the human, because a lot of times the compiler understands exactly what's going on, but I'm pretty clueless when I come back after only a few days. I think you meant not understanding how the language works so using a lot of extra commands when one would do. However it's common to "dumb down" your code, especially if it is tricky, for the poor schmuck that has to maintain it. Remember -- writing code should not be like writing a mystery novel.