Re:In defense of print statements
on
Pro Perl Debugging
·
· Score: 2, Interesting
The issue of whether to use a debugger or not is a matter of speed and ease of debugging. There's few things you can't do with print statements that you can do with the debugger. [There are some: try using printf to get a backtrace of a segfault in C.] Lacing your program with print statements to check values is a time consuming, annoying, and certainly uglifies your code. Worse still, if you didn't anticipate wanting to see the value of some variable in advance, you will have to modify your program, (compile it), restart it, and get back to the point at which the bug is occuring--in some cases this can be very time consuming. With a debugger you don't have to anticipate anything. And you can modify values, which is often quite useful. [In Perl, as opposed to C, you can basically do anything you want in the debugger, including replace subroutines with new versions.] In some debuggers you can even try some stuff and then restart the current subroutine and step through it again from the beginning by popping the stack! [I'm not sure if you can do this in Perl, but gdb lets you do this for C programs].
Admittedly, there is a time and place for everything. I especially favor print statements when you need to consider non-localized program behavior: compare values at many different points of the program or across many iterations of some loop. In such cases, using the debugger is usually annoying and far too slow. A really useful technique for this kind of debugging is to format the printf output so that it can be piped into a database like postgres or mysql. Once you have the debugging output in a database table, you have a really powerful way to pore through the data trying to figure out what's going on.
[That's one freelance Perl programmer I'll have to remember never to hire.]
Seriously, I'm one of those people who use a debugger every day. Actually, when I write new code in Perl, often the first thing I do is step through it in the debugger to make sure it does what I think it should. Especially in Perl, it is very easy to accidentally do something that's a little off. With the "wait until something goes wrong before I investigate" attitude demonstrated here, you'll never know anything is amiss until some nasty bug crops up as a result. Using the debugger to sanity check my code means that I catch most bugs before they ever cause problems.
I'm sure I'm going to get some snide remarks about this approach, but really, I've been a serious Perl programmer for about eight years now, and often write moderately complex Perl programs that work perfectly the first time--run through the debugger or not. I can't say that about any other language, and it's something most people can't say about any language, let alone Perl;)
See the only problem with your terms is when most people think of "Freedom" they think of you know, freedom from slavery or oppression like the Civil Rights Movement or Sufferage Movement...etc and not some hard to use operating system hardware mainly used by geeks who have a hard time socially communicating their ideas to normal people.
This may be the case today, but with huge boom in blogging and increasing numbers of people continually receiving and providing more information over the Internet, I don't think it will take too long before people identify freedom of expression with their computers. Once that happens, the issue of whether you actually are free to use your own computer as you see fit or not becomes vital to your freedom.
The major technology enabling modern democracy was the printing press and the freedom of information that it provided. The Internet is the modern printing press, and it democratizes information in an even more fundamental way then the printing press did. Free access to the internet – i.e. unfettered use of a computer – is vital to that new freedom. So of course, there are people out there who are trying to restrict that freedom before people have realized just how important what they're trying to take away is.
This may be more of a testament to the fact that the average/. user doesn't really need AV software. If you don't use Outlook, use Firefox instead of IE, and don't download and install fairly stupid things, you can avoid most chances of getting infected.
Of course, I don't know — maybe these are great products. I don't use any AV software personally, since there are zero viruses for OS X.
This is a meaningless test. I can write an AV program that will get 6/6 no matter what you feed it: it always returns positive. Is that actually helpful? Obviously not. The article mentions that the products that scored 6/6 have a higher false positive rate. Sounds harmless, but even the tiniest false positive rate renders a product completely unusable when the volume of scanned items is high. So what does this test actually reveal? Absolutely nothing.
[BvL]
This is precisely the sort of crap that gives people horrific psychological complexes and neuroses. You can't control what you think or feel, so don't beat yourself up over it. And I certainly won't accept some other self-righteous prick^H^H^H^H^H individual telling me that I should feel guilty for my thoughts. Or worse still, that they make me evil! What you can control is what you do and how you treat the people around you. If everyone in the world stopped telling other people what they should or should not be thinking and concentrated on just treating everyone decently, then it would be a much better place.
Moreover, trying to suppress "evil" thoughts and feelings is just a bad idea. When thoughts and feelings come to you, you can't really help it. It is much healthier to accept them, not feel guilty or bad, not beat yourself up, and accept them for what they are: just thoughts and feelings. Repression just leads to bad things. Perfect example: the Catholic Church's difficulties with paedophilia--you repress normal sexual urges and that's the kind of thing you get instead. Much better to accept that priests are normal sexual individuals and that there's nothing wrong with that. Of course, some of them are definitely not normal sexual individuals, but that's another story.
Your point taken to it's logical conclusion means that we should avoid all pleasure because otherwise we are falling prey to lust. If that is not your view, then where do you draw the line? Why does pornography fall on the wrong side of this line? What about other things? Premarital sex? Gay sex? Video games? Junk food? Personally I think the last item is the most evil on the list, but that's just my opinion.
Self control is definitely important, but the key--as it seems to me--is to do those things that you truly want to do, that will make you happier. Don't just spend endless hours feverishly downloading porn and whacking off. You'll end up feeling like shit--hollow, empty and worthless. Read a book instead. Don't snarf down some nasty junk food; make a decent meal instead.
But by your logic, if pornography is evil, so is junk food. Actually, it's probably worse.
The trouble is that this is a marketing survey. They care about the relative size of their marketing groups: i.e. what percentage of the gaming market is represented by each demographic group. What most people want to know is what is the rate of gaming in each group. The following analysis calculates that (in a relative way, based on their data).
Based on population data from the 2000 US Census, the US population breaks down like this:
female 6-17: 9.6 male 6-17: 9.3 female 18+: 37.8 male 18+: 36.5
The ratio of the percentage of gamers to the percentage of population gives us a relative measure of "gaming likeliness":
female 6-17: 1.25 = 12/9.6 male 6-17: 2.26 = 21/9.3 female 18+: 0.69 = 26/37.8 male 18+: 1.04 = 38/36.5
What the hell does this ratio mean? Well, it can't be translated into an absolute gaming rate since we don't know the total rate of gamers in the population. But it does tell us that males between 6 and 17 are 3.28 (=2.26/0.69) times as likely to be gamers as females over 18.
So the numbers are really not as surprising as they seem to be. However, they are significant from a marketing perspective: women are an important gaming market these days. This is excellent news and should keep things interesting.
The issue of whether to use a debugger or not is a matter of speed and ease of debugging. There's few things you can't do with print statements that you can do with the debugger. [There are some: try using printf to get a backtrace of a segfault in C.] Lacing your program with print statements to check values is a time consuming, annoying, and certainly uglifies your code. Worse still, if you didn't anticipate wanting to see the value of some variable in advance, you will have to modify your program, (compile it), restart it, and get back to the point at which the bug is occuring--in some cases this can be very time consuming. With a debugger you don't have to anticipate anything. And you can modify values, which is often quite useful. [In Perl, as opposed to C, you can basically do anything you want in the debugger, including replace subroutines with new versions.] In some debuggers you can even try some stuff and then restart the current subroutine and step through it again from the beginning by popping the stack! [I'm not sure if you can do this in Perl, but gdb lets you do this for C programs].
Admittedly, there is a time and place for everything. I especially favor print statements when you need to consider non-localized program behavior: compare values at many different points of the program or across many iterations of some loop. In such cases, using the debugger is usually annoying and far too slow. A really useful technique for this kind of debugging is to format the printf output so that it can be piped into a database like postgres or mysql. Once you have the debugging output in a database table, you have a really powerful way to pore through the data trying to figure out what's going on.
[B/v/L]
[That's one freelance Perl programmer I'll have to remember never to hire.]
;)
Seriously, I'm one of those people who use a debugger every day. Actually, when I write new code in Perl, often the first thing I do is step through it in the debugger to make sure it does what I think it should. Especially in Perl, it is very easy to accidentally do something that's a little off. With the "wait until something goes wrong before I investigate" attitude demonstrated here, you'll never know anything is amiss until some nasty bug crops up as a result. Using the debugger to sanity check my code means that I catch most bugs before they ever cause problems.
I'm sure I'm going to get some snide remarks about this approach, but really, I've been a serious Perl programmer for about eight years now, and often write moderately complex Perl programs that work perfectly the first time--run through the debugger or not. I can't say that about any other language, and it's something most people can't say about any language, let alone Perl
[B/v/L]
This may be the case today, but with huge boom in blogging and increasing numbers of people continually receiving and providing more information over the Internet, I don't think it will take too long before people identify freedom of expression with their computers. Once that happens, the issue of whether you actually are free to use your own computer as you see fit or not becomes vital to your freedom.
The major technology enabling modern democracy was the printing press and the freedom of information that it provided. The Internet is the modern printing press, and it democratizes information in an even more fundamental way then the printing press did. Free access to the internet – i.e. unfettered use of a computer – is vital to that new freedom. So of course, there are people out there who are trying to restrict that freedom before people have realized just how important what they're trying to take away is.
[B/v/L]
This may be more of a testament to the fact that the average /. user doesn't really need AV software. If you don't use Outlook, use Firefox instead of IE, and don't download and install fairly stupid things, you can avoid most chances of getting infected.
Of course, I don't know — maybe these are great products. I don't use any AV software personally, since there are zero viruses for OS X.
[BvL]
This is a meaningless test. I can write an AV program that will get 6/6 no matter what you feed it: it always returns positive. Is that actually helpful? Obviously not. The article mentions that the products that scored 6/6 have a higher false positive rate. Sounds harmless, but even the tiniest false positive rate renders a product completely unusable when the volume of scanned items is high. So what does this test actually reveal? Absolutely nothing. [BvL]
This is precisely the sort of crap that gives people horrific psychological complexes and neuroses. You can't control what you think or feel, so don't beat yourself up over it. And I certainly won't accept some other self-righteous prick^H^H^H^H^H individual telling me that I should feel guilty for my thoughts. Or worse still, that they make me evil! What you can control is what you do and how you treat the people around you. If everyone in the world stopped telling other people what they should or should not be thinking and concentrated on just treating everyone decently, then it would be a much better place.
Moreover, trying to suppress "evil" thoughts and feelings is just a bad idea. When thoughts and feelings come to you, you can't really help it. It is much healthier to accept them, not feel guilty or bad, not beat yourself up, and accept them for what they are: just thoughts and feelings. Repression just leads to bad things. Perfect example: the Catholic Church's difficulties with paedophilia--you repress normal sexual urges and that's the kind of thing you get instead. Much better to accept that priests are normal sexual individuals and that there's nothing wrong with that. Of course, some of them are definitely not normal sexual individuals, but that's another story.
Your point taken to it's logical conclusion means that we should avoid all pleasure because otherwise we are falling prey to lust. If that is not your view, then where do you draw the line? Why does pornography fall on the wrong side of this line? What about other things? Premarital sex? Gay sex? Video games? Junk food? Personally I think the last item is the most evil on the list, but that's just my opinion.
Self control is definitely important, but the key--as it seems to me--is to do those things that you truly want to do, that will make you happier. Don't just spend endless hours feverishly downloading porn and whacking off. You'll end up feeling like shit--hollow, empty and worthless. Read a book instead. Don't snarf down some nasty junk food; make a decent meal instead.
But by your logic, if pornography is evil, so is junk food. Actually, it's probably worse.
For the analysis of the numbers, see my post above.
The trouble is that this is a marketing survey. They care about the relative size of their marketing groups: i.e. what percentage of the gaming market is represented by each demographic group. What most people want to know is what is the rate of gaming in each group. The following analysis calculates that (in a relative way, based on their data).
Based on population data from the 2000 US Census, the US population breaks down like this:
The ratio of the percentage of gamers to the percentage of population gives us a relative measure of "gaming likeliness":
What the hell does this ratio mean? Well, it can't be translated into an absolute gaming rate since we don't know the total rate of gamers in the population. But it does tell us that males between 6 and 17 are 3.28 (=2.26/0.69) times as likely to be gamers as females over 18.
So the numbers are really not as surprising as they seem to be. However, they are significant from a marketing perspective: women are an important gaming market these days. This is excellent news and should keep things interesting.
The real lesson: statistics are tricky.