3 ms·
I don't actually have any argument against what you said, in fact I agree wholeheartedly that the answer is the OP should empirically prove what they claim. Nev
by pi18n 14y ago
I don't actually have any argument against what you said, in fact I agree wholeheartedly that the answer is the OP should empirically prove what they claim. Nevertheless, I hope you won't take offense if I use that as the starting pistol of a short rant.
I find that kind of commentary irritating because I have a co-worker that thinks he is the more talented programmer. What's worse is that he is rude about it.
I think I am objectively better for the following reasons; my work has shorter functions, less inter-dependency between classes, is simpler to reuse, and most importantly it crashes less. If I asked a question like, "how can I get this guy to stop being a douchebag and listen to my suggestions (which I swear would improve the company's codebase)?", I'd be irked by the commentary.
Anyway, I'm sure you all think this is a bunch of sound and fury, signifying nothing, but it felt good to type it out. Cheers and good wishes to all.
- pi18n 14y agoActually I saw the first comment about the boss posting as well, which altered how I judged all latter comments. All the other posters were fairly respectful and mostly wrote the OP should consider that he might be wrong. Can't disagree with that, really.
- PommeDeTerre 14y agoHave you considered that your "objective" analysis of what is "better" may still be very subjective, or just plain worse in some cases? A large number of shorter functions, for example, can often be much harder to work with than one larger function that performs the equivalent processing. To properly understand such code (especially when it was written by somebody else), one must jump around from function to function, rather than just reading through one function from the top to the bottom. Likewise, "less interdependency between classes" often translates to more complexity in other places. To get usable software, the classes will still need to be connected together somehow. Sometimes this is done via automatic dependency injection, which usually brings in a whole new set of problems. Reuse is another "best practice" that often turns out to be bad in practice. It only works in those cases where the functionality being reused is truly general. Forced reuse of other, less-general code will often be problematic. The reused code soon starts needing to take into account slight variations in order to be used in several different places, and over time this builds up. This can ruin the code, resulting in a situation worse than had a bit of duplication been accepted. Crashing code isn't necessarily a problem, either. Taking a fail-fast approach is often a good way to detect unforeseen problems while developing code, before it gets into production use. Even once in production, it's better to have software crash in an obvious and reproducible way, so it can be more easily and rapidly fixed. It's often best for it to stop working completely, than it is to continue on and perhaps cause many more problems (such as data corruption, or a huge amount of network traffic, and so forth). It can be much worse to deal with code that "doesn't crash", but only because the original programmers caught and silently discarded any exceptions that were thrown, or error conditions that were raised. What you see as "good code" may, in a given context, actually be quite problematic. Perhaps your co-worker realizes this, and this is the cause for some of the friction you're experiencing.
- caw 14y ago> A large number of shorter functions, for example, can often be much harder to work with than one larger function that performs the equivalent processing. To properly understand such code (especially when it was written by somebody else), one must jump around from function to function, rather than just reading through one function from the top to the bottom. I wonder if there's an IDE that can do this -- substitute function calls with the actual function on demand. That might make both camps happy. It's readable in 1 sitting, but also DRY'd out.
- ZoFreX 14y agoThere's a plugin available for Visual Studio that does something like that: http://visualstudiogallery.msdn.microsoft.com/4a979842-b9aa-4adf-bfef-83bd428a0acb http://visualstudiogallery.msdn.microsoft.com/4a979842-b9aa-...
- pi18n 14y agoThis is exactly what I thought would be irksome, and it was :) I am aware that it is hard to avoid a subjective analysis when it involves oneself, yes. So I'll just say, as far as your points on long functions, interdependency, and reuse, I agree, to a point. I'm not exactly writing, say, single line functions, though. As far as crashing goes, I throw exceptions over corrupting data, please give me some credit. I mean crashing as in some internal state goes awry (e.g., failing to lock properly in multithreaded code) so he doesn't know why it is crashing. I will take your comments under consideration. I'm afraid there's nothing I can do here that will prove I know what I am talking about, so I guess you will have to draw your conclusion on our dialog alone.