Commenting Your Code: Is it Just For Programmers?
From most good programmers, if you’re being taught how to program in any compiled or interpreted language, you’ll often hear the mantra Comment your code
or something similar. Why? Because good comments are worth their weight in gold. It lets others (and you when you’ve put the code away for a while) know what you are trying to accomplish with particular pieces of code. Can’t figure out what a sub-routine is doing or why it’s in there? Read the code and look for comments on it. Chances are, if the programmer had good commenting habits (even if the program your using was one of his first attempts and isn’t that great), chances are you’ll be able to quickly diagnose any problems because you’ll know what that sub-routine is supposed to be doing.
So is commenting your code just a mantra for C, C++, Perl, Ruby, Python, et al programmers? I say no. As a web developer I find websites that have even minimal comments in their code about what is supposed to go there, or why a particular structure exists, is infinitely more useful than a thousand tutorials on how to do the same thing. Conditional comments are even better. It lets you know that there is a problem with certain browsers displaying an element and shows you what the work around is. If you were to implement the work around without any head nod toward the issue (say you did it with a linked javascript, but you don’t give a reason for having it) than someone is likely to encounter the same thing and spend more time trying to reinvent the wheel instead of reusing your bit of code (or some modified version thereof; I don’t have anything to say on code reuse except to adhere to any copyright notices to original content and javascript where any such notice exists).
If at the very least you comment your code, you are allowing other web developers to learn from your own experiences without having to teach them directly and you are reminding yourself why you put that bit of code into the mix in the first place. It also allows you to remember why it’s there when you go back to edit it six months from now.
HTML obfuscation on the Internet is all but impossible. Did someone browse to your site? A copy of the page that they can open with a text editor lies in cache or Temporary Internet Files (or whatever Microsoft calls it these days). Did your page get spidered? A copy with any javascript "protection&qoute; disabled is available for viewing. So why fight against the inevitable. Even if no one else but you looks at your code, those comments can mean the difference between quick and painless updates or hours spent trying to figure out just what you were trying to do while simultaneously trying to update the site in such a way that it doesn’t completely break (I’ve done it before and I’m sure I’m not the only one).
Commenting your code isn’t just for programmers. It’s for anyone who lays down any sort of code whether it is HTML (rendered), Perl (interpreted), or C (compiled). So next time you go out and design your website, or even going back to edit an old one, don’t forget to include comments on what you are doing. Right now I’m working on a site for a client that is getting rather complex rather quick. If it weren’t for me even just commenting where certain div containers end and begin, I’d spend unnecessary time trying to find those end points. Since I started commenting from the beginning, while the page size is slightly bigger for it, I’m able to more quickly go from place to place without having to worry about closing out tags in the wrong div.
Technorati Tags: technology, computers, programming, web, html
accomplishedDo We Have Unrealistic Expectations with Computers?
I’m on more than a few mailing lists that are user support oriented (everyone on the list helps everyone else if they can) and one of the biggest issues I see with people using software aren’t special use cases, which for most of the mailing lists I’m on make up a very small minority of the posts, but are installation issues. They download the software, think they have installed it, are told to reboot the computer and either something strange happens (like the computer hangs on shutdown) or they reboot and cannot find the install file they just downloaded.
I have a sneaking suspicion that these users fall into one of two categories.
Category B-One: The n00b
These are the users that buy a computer, are told amazing things about their capabilities, and when they get home they expect the computer to do everything include making the coffee. Even after many years of computer use, the n00b never gets out of this mode of thinking and often runs into problems with the most basic of tasks if for some reason something doesn’t go as expected. This type of user exists everywhere. Usenet. Forums. Mailing lists. You might even have some n00bs in your own home! Of course I do not use this term in the pejorative (although n00bs definitely task my patience more often than not) but only to describe a type of computer user.
Category B-Two: The neophyte
The neophyte, or newb (note difference in spelling), is someone who just bought a computer, has been told all the wonderful things their computer can do (and probably only believes half of those claims (and rightly so, making coffee is a non-standard feature folks!)), get home and begin using it. They initially have the same amount of problems as the n00b, but over time they actually learn how to use their computer and soon progress to asking questions only when there are problems in special cases (like they are trying to work with a large spreadsheet that is doing multiple calculations and are trying to split it up between multiple sheets while keeping the calculations linked) or they cannot find a solution anywhere on the net.
For category one users, there is nothing to be done accept to have patience with them. They are never going to learn because they think or have been told they don’t have to learn. They have been trained and told so many times that their computer can do everything for them without thinking that when they sit in front of the computer, they stop thinking.
For category two users (the category I think most regulars on a support list wish everyone would become), there definitely still has to be patience for their neophyte age, but a warm welcome to the club once they have reached that plateau where they are ready and willing to help others. Of course upon reaching that plateau, we also hope that they do not become so enamored with their accomplishment that they become one of the next two categories of users.
Category C-One: 31337 h4×0rz
Someone who has become so enamored with their own successes and the ease with which they came, forget where they started and that everyone starts out there. They are haughty, often given to dreaming up of form flames for those who seem too dense to learn anything, and have no care for lesser beings
. This kind of behavior is a gateway for the next category.
Category C-Two: The troll
The troll generally has no problems, and if he is a regular on the list generally sticks around only to point out others mistakes (no matter how insignificant or inconsequential they may be), have ardent beliefs about certain things that they think everyone should stick to (and will start and continue discussions on those points) such as what should and should not appear in someone else’s signature line, the use of url shorten-ers, or the benefits of in-line vs. bottom or top posting (I’ve been involved in the latter, but hopefully in a non-confrontational manner while the troll is all about confrontation). Those are just some of the topics a troll will continually bellow about. The best thing to do for a troll is to ignore them and hope they go away or learn to tolerate them.
Neither of the above two categories are very helpful to the first two categories. They cause skewed expectations for users so they are now afraid to join other support lists because of the abuse they received at the hands (indirectly or otherwise, anyone who opens a flame is abused, not just the recipient) of 31337 h4×0rz and trolls.
The most prized of all help on a mailing list, and those who have realistic expectations of what a computer can and cannot do, are those who fall into the following two categories.
Category A-One: The developer
The developer is someone who has major amounts of time providing code to a software project and is considered to be one of the sources of information for the complete ins and outs of any particular piece of software. Often haughty, they do sometimes try to have a humble attitude toward both n00bs and neophytes, while despising (rightly so) the h4×0r and troll. While the view that they now the piece of software like the back of their hand is often unrealistic — they may just work on one particular piece of the entire project — they know where to do for the answer. If you can find humble developers, you’ve truly found people worth emulating and a project worth supporting.
Category A-Two: The expert
While this category of user might not be an actual expert, they have enough experience using whatever software your asking for help with that if they don’t know the answer, they know where to point you. Sometimes they can also seem haughty and intimidating as their first response is to RTFM, a suggestion to read the actual documentation (if the question is about basic features) is quite common because it can not only be illuminating about the issue at hand, but others that might crop up (and now probably won’t because you’ve read the documentation) in the future. This is the type of user that every developer hopes that the neophyte will become, and even has the vague hope that a n00b will someday reach this level too.
What all does this have to do with expectations? A lot, unfortunately.
n00bs expect everything to work automagically with minimal intervention and learning on their part. Life just isn’t like that. It’s a continuous learning experience no matter what you’ve been told. When you download an installation file, it requires you to at the very least click on icons representing the file and to follow instructions printed on your screen. You have to make choices, even if you leave things at the default (there is no such thing as not making a choice). Unfortunately, too many people have the misconception that computers are magical work devices so ingrained to them that it is all but impossible to remove. The C- category of computer users are also in the pickle of having what is unacceptable behavior so ingrained that they do not know any other way of being. I think I fall somewhere outside of all those categories, because I have moments where I’m all of them (except developer, I am not a hacker (in the sense of being a clever programmer)), as much as I hate to admit it.
Computers don’t “just work”. They need input, whether from a human in the form of clicking on a mouse and typing at a keyboard or in the form of a program (which was created by someone most likely typing at a keyboard and/or clicking on a mouse). There also needs to be responsibility for ones actions at all levels. The n00b and neophyte both need to understand that their actions have all sorts of consequences (including unintended ones) whether they are negative or positive. h4×0rz and trolls understand that and try to use it to their own advantage (extended flame wars without them trying and the like). That is simply a lack of morals. Good moral behavior excludes trolling. It excludes the haughty behavior of the so-called h4×0r. The developer and the expert just need to continue working on their patience and thick skins since, unfortunately, the whole world will not become one of them. In reality only a tiny minority will ever actually make it to that level. For those on the way, that simply means we need to positively reinforce them, even if it’s with a small, off-list thank-you for the help they have provided. The n00bs and neophytes of the world make up a majority of all users out there. There is constantly new software in development and new people trying it out.
Even the Bible is clear on this subject:
Whoever loves instruction loves knowledge, But he who hates correction is stupid.
Proverbs 12:1 (NKJV, the RefTagger might display the NIV version, which replaces instruction with discipline).
So it is with computers. Those who love instruction eventually become experts or developers. Those who hate correction are doomed to be n00bs (and even possibly trollish n00bs). Just don’t forget who the source of all knowledge is.
accomplishedHowTo: Blocking Websites
Are you sick of Internet ads but don’t want to be bothered using FireFox and the Adblocker extension (which works wonderfully, by the way)? Or how about your kids going to sites which you don’t approve of? Are you using Windows (specifically XP)?
Well then I have a tip for you that will help you get a handle on what sites are loaded in your browser. For this example we are going to block Yahoo. How to block it is really simple.
First, you need to find a file simply called hosts. On most versions of Windows this should be in
C:\WINDOWS\system32\drivers\etc
The file has no extension but it’s a plain text file so you can use notepad without any problems. Once you have the file open, you should see something like this at the top:
# Copyright (c) 1993-1999 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
Pretty much telling you exactly how to do it with one entry defined:
127.0.0.1 localhost
You do not want to change that entry. It’s how the computer recognizes itself as home and how network services “connect” to a network without there actually being a connection to the Internet or any other network.
To block a website, Yahoo in this example, you’ll want to add another entry that looks like this:
127.0.0.1 yahoo.com
Once you restart your network connection (do it however you like), yahoo should be completely blocked.
Now this only works on the top level Yahoo domain. Any sub-domains might still be available. To block any sub-domains, you’ll have to block them one at a time following the same format.
There are programs out there that automatically generate a list of known harmful websites (pornography, sites that distribute malware, etc.) that also allows for easy editing of the hosts files. If I only had to recommend one, I would recommend Spybot – Search & Destroy. It’s free, it searches for malware on your computer (mostly software that tracks your usage of the Internet (aka spyware)), allows for the editing of your hosts file, and is free and fairly simple to use.
Of course I like doing things without having to install any software and the above mentioned method for blocking websites is by far the easiest. You don’t have to be a computer guru to edit the file, just remember the changes you’ve made. If you ever want to undo them, just delete the entry in question and restart your network connection. Another bonus is that while you have to do a little more monitoring yourself, in the end you don’t have to pay someone else to block the sites for you.
Update: One thing I failed to mention, when you save the edited file, you’ll have to delete the original and rename the file you saved from hosts.txt to just hosts, otherwise it won’t work. For some reason notepad won’t save this file without the extension. Don’t worry about the warning about removing the file extension. In this case it isn’t needed.
Technorati Tags: technology, computers
accomplishedMemory Has Arrived
My memory has arrived and is performing well so far. Still can’t play Guild Wars, but my bro-in-law says it might be a RAM I/O problem, meaning new motherboard. Ah well. Just have to start saving up to a new computer now. I’ll keep this one running for various other stuff. I just won’t be able to play my favorite MMO.
Technorati Tags: technology, computers, hardware
accomplished


