There have been several prominent intelligent programmers that have postulated over the years that if you name your variables and functions well enough, and architect your application well, that comments become unnecessary. While I agree with the premise - making your code readable enough that comments are unnecessary - I still feel that Comments are necessary... (Wait, what?!) Or rather, I think they still play an important role and should still be included, though perhaps to a lesser extent. For one thing, even if your code is completely self-evident, comments help reinforce what's supposed to be happening in the code. Let's face it, most of the time when you're debugging someone else's code (or even your own), you eventually find the offending snippet, and stop to wonder, "Was this done intentionally for some reason, or was it an accidental omission?" Code Commenting helps make it clear. If the code agrees with the comments, it was intentional, otherwise, it was probably just a brain-fart. This can save a lot of time and mental anquish. The second thing I consider comments for is to summarize sections of code. Almost every IDE out there will color your comments differently than your code. By summarizing what the next 10 lines of code are doing, I only have to scan 1 out of 10 lines to get the idea of what's going on. No matter how well you name your variables/functions, you can't beat that level of efficieny The other thing that these proponents seem to forget is that sometimes you just do something clever. Sometimes you just find a way to save 100 lines of code with a single line that's a little cryptic. I suppose some would argue that you should write the 100 lines of code anyway, just so it's clear, but for me, there's a limit there. If I can write a piece of code clearly in two lines or cryptically in 1, I'll write the second line. But once you get up to about a 6 or 7 line savings, sorry, but I'll just add a comment explaining what I'm doing, and you can write me an email telling me I'm the devil.
Ray Camden has a post venting about an admitedly annoying feature of the Windows OS. I completely agree with Ray's sentiment, but it brought to mind an idea I've had that could have alleviated Ray's shagrin. I'd like to propose a universal DAMMIT keyword to be implemented in all programming languages and command-line syntaxes. This special keyword essentially bypasses all idiot-proofing warnings and safeguards and causes the base command to be executed regardless. Example DROP TABLE(employees)
GO
-- Cannot drop table EMPLOYEES. Table is in use
DROP TABLE(employees) DAMMIT
GO
-- Command completed successfully Obviously this could be abused, so users may need to provide their TCID to unlock this functionality.
I've always felt that my life would be immeasurably easier if I could apply and qualify for a Technical Competence ID card. In this day and age, isn't this a concept that is long past due? How many times have you experienced this? You walk into Best Buy to pick up a laptop they've got on sale, and you necessarily have to engage one of their wonderfully competent salespeople (I'm sorry, I mispelled that word before "competent" please just remove the "nd" and the "r"). You tell them you'd like to buy the HP 389xII, and, of course you're presented with this question, "M-hmm, and what are you going to use the computer for?" At this point, the first thought that pops into my head is, "If I were to try to explain to you what I'm going to use the computer for, we'd spend the whole day here while I tried to educate you up to the level where we could have an intelligent conversation." But I don't say that. Somehow, however, I need to convey to this person that I know what I'm doing, I know what I want, and please just take the key out of your pocket, open up the cage, and pull one of those shiny boxes out of it so I can pay for it, take it home and forget who you are. I don't say that either, however. Usually what I try to do is convince this person of my technical competence by using words that are bigger than he understands, which usually does the trick. Let's face it however, this is slightly demeaning and degrading for the salesperson, and as much as I resent his well-intentioned intrusion into my buying process, he's probably not really a bad guy or even stupid. He's more than likely just some guy trying to get through college and make enough money to buy his own geek toys. There's no real reason I want to make this guy feel bad about himself. I just want to buy the computer without hassle. Here's where my fantasy life takes over. (Admittedly, my fantasy life is lame, but it works well for the moment). In my fantasy, instead of saying anything, I just pull out my Technical Competence ID card, and the sales person says, "I see Mr. French. Sorry to have bothered you. Just give me a second while I get your computer." Doesn't that sound like a better situation for everyone involved? I would gladly take an annual certification and pay, say a $100 fee for the privilege of weilding a universally recognized card that proved I had a brain in my head and a general knowledge of technology. Of course, the applications are near-infinite. Imagine this tech-support call:
Tech: Thank you for calling [ISPname], how may I help you?
You: My router's flaking out, I think I'm getting interference on the line.
Tech: Ok, let's take first things first. Is your computer on?
You: Yes. My TCID is 4475639839.
Tech: Ok, just ftp your router logs and I'll take a look on our end and call you back.
You: Thank you very much.
Tell me, honestly. Is there any one of you that wouldn't give up one of your kids for this time-saver? Please, somebody (not Microsoft), create this certification process and save the IT world millions of hours a year, which we promise to then spend on continuing to solve the worlds biggest problem such as "getting your Outlook to work."
This is a concept that I use frequently when talking with people, especially when trying to inspire them to do better, but I usually have to re-explain it each time, which gets kindof old. So I figured I'd post it here, and what with the mass media hysteria that will no doubt be generated from the event, the concept would get diseminated throughout the world, become common nomenclature, and I would therefore never again have to explain it myself. What?! sounds unrealistic? Well, one can wish. In any case, it's worth the time it takes to type it out - you know - just in case. At some point in my career, I became aware that every professional, be it artist, programmer, figure-skater, or stock-broker, travels through three tiers of excellence (or lack there-of) on their way to being the best. Tier one is the one we all start out in. You break into this tier by going from an amateur to a professional - by which I mean you at least get paid for your work...sometimes...by someone. Whether or not your work can actually be called "good" or not is perhaps less of a surety, but you've at least made it into the ranks of employed. In this stage, you are doing your best to imitate "the big guys" and you judge yourself by how close you can come to imitating them. Each project you complete will contain some aspects that are "professional-grade" and some aspects that are not. But if you have more aspects that are than aren't, you feel pretty good about yourself. this is the first tier. The second tier is when you have improved enough that your work is indistinguishable from the big boys. You've perfected your craft, and now tout your work as (in our case) "professional-looking websites" In the second tier, you judge yourself by how perfectly you adhere to the industry standard. Most people only ever achieve this tier, and spend their entire careers trying to keep up with the changing industry, especially in a dynamic one like technology. The third tier of excellence usually takes you by surprise. It starts by just coming up with innovations - new ways to do old things, and as you become enthralled in trying to figure out how to build a better mousetrap, you wake up one morning and realize that you are the industry standard. You are the one that everyone else is trying to imitate, and are judging themselves based on how closely they can mimic your work. I myself have only ever briefly achieved third-tier excellence, and in my case, I didn't keep up with my craft, as was soon passed by more ambitious and creative players. Don't ask me to identify when or how, I don't remember the exact circumstances. I only remember the feeling. And it was a good feeling.
I'm not a fan of the Open source concept. I know, I know, I'm the devil, right? Ok, let me rephrase. I guess I'm a fan of a company making their product open source - like Adobe annouced yesterday, if they can do it and still make a profit. I mean, I like buying legitimate software products that let me tinker with how it works so I can make it work the way I want. That's awesome. At least it seems like it at first. But here's the problem. You've only got two choices, make the code-base truly open, or have a central group of programmers control the code-base, either a corporate entity, or - as "open-source" usually implies - volunteers. And here's the problem. If you truly open up the source to anyone, you get a wikipedia-style mish-mash of ideas. I'm not sure that's even really possible and still have a product that will actually run without crashing. So you've got to have some sort of control over the code. What that means in practical terms then, is that if I want to change something about how my version of Outlook works (I've always hated how limited the inbox rules were), I'm free to do that (if Outlook were open-source, I mean), but as soon as I upgrade to the next version of Outlook, I've over-written my changes and have to make them again. Sorry, but that's just too time-consuming to be useful. The other thing that turns me off
[More]
|
|