Michael A. Covington    Michael A. Covington
Books by Michael Covington
Consulting Services
Previous months
About this notebook
Search site or Web
Ichthys

Daily Notebook

Popular topics on this page:
On the source of the Sunk Cost Fallacy
C# style guide
The Bible isn't half as silly as people say
It's time to spam-filter the telephone!
Astrophotos:
Moon (Sinus Iridum)
Moon (at perigee, color-enhanced)
Sun (with sunspots)
Sun (with sunspots)
Mars
Saturn
Many more...

For more topics, scroll down, press Ctrl-F to search the page, or check previous months.

For the latest version of this page at any time, use this link: www.covingtoninnovations.com/michael/blog



2012
May
17

A small point of C# style:
A class and an instance of it can have the same name

In one of my large computer programs there was an object called Analysis (actually a field of another class), and it was of a class called AnalysisInfo.

After some thought I concluded that AnalysisInfo is a silly name — it's like saying AnalysisClass or AnalysisType — and I changed it to Analysis. Now the class and the instance have the same name.

Some purists may cringe, but actually, I've done nothing undesirable. The C# language is carefully designed so that class names and object names are always distinguishable. They even come up in different colors in the editor.

A classic example is that various graphical objects have a property called Color whose type is also called Color. It would be silly to call them ColorValue and ColorType or anything like that.

Also, it is quite reasonable for the type of an enumerated variable to have the same name as the enumeration. Then you can say things like

Color c = Color.Red;

and so forth. See also this.

2012
May
16

It's time to spam-filter the telephone!

This will seem obvious in retrospect. Just like e-mail, telephone calls ought to be spam-filtered. That would do a great deal to rid us of pesky robocalls, bogus charities, and phishers.

Telephone networks are already computer-controlled. Why not check all incoming calls against a database of known spammers? Such databases already exist on the Web, and anyone running a telephone company could easily gather more information to add to it. You could also block calls whose Caller ID data is missing or appears to be fake.

In uncertain cases you could do a challenge and response: "To complete this call, dial 4 2 7 now." Instead of 4 2 7 it would be a different random number each time, with a lot of variation in the timing and exact wording of the message. That would foil robocallers.

I'm putting this idea out there for anyone to exploit. I'm not filing for a patent, but if you want to, and you need me as a co-inventor so that this blog entry does not invalidate your application, let me know. Mostly, I just want to see it done.


[Addendum:] I'm getting a flurry of correspondence about this. Let me explain that what I want is not any of the following things, which already exist:

  • A telephone that blocks calls from numbers that I enter into it. This can already be done with various digital telephones and with AT&T cellphones (the latter using "parental controls").

    I want someone else to keep track of spammers' numbers, and for this information to be shared in real time, just like spam filter databases used by e-mail systems.
  • A government agency with which I can register my phone number and say, "Don't let spammers call me." The United States already has this (the Do-Not-Call List), and other countries are setting up similar things. The problem is that the spammers are mostly not law-abiding or honest. The current U.S. Do-Not-Call law has many loopholes (e.g., for politicians, financial institutions, and anyone with whom you have ever done business).

    I'm wanting technology, not regulation. My telephone is a machine I own, and I should be able to control who else can use it, and my telephone carrier should help me do that.
  • A smartphone that gets the spam number database through the Internet and rejects certain calls when they arrive. That already exists (at least I've heard reliable rumors), but I want the spam filtering to be done by the telephone system itself, not the telephone.

Fifty years ago, telephone companies were very proactive in trying to prevent "nuisance calls" and any form of harassment. They realized the telephone had the possibility of becoming a large-scale public nuisance. They also had control; long-distance calling was so expensive that nuisance calls rarely came from very far away. Nowadays, telephony is so cheap that spammers can call you from halfway around the world, completely hiding where they really are.

2012
May
12-15

The Bible isn't half as silly as people say

All of a sudden, the news media are full of people trying to make out that the Bible is a book of absurdities. According to them, if we follow the Bible we have to reject not only fornication but also shellfish. We have to burn witches (or something like that) but never touch a pig. And so on.

This is supposed to discredit Christianity. The agenda, of course, is to claim that the Judeo-Christian concept of marriage is worthless.

In fact, though, I think it's a display of gullibility and ignorance and bad faith — all three mixed in unknown proportions — on the part of the anti-Bible crowd.

The reason is simple. Pulling out isolated sentences is not the right way to read any book, whether it's the Bible or the latest novel. You have to take things in context. You have to inquire what is meant, what purpose everything serves, not just how strange things sound out of context. (Some of the present crop of self-appointed critics might want to start by looking for the difference between moral and ceremonial law.)

And there's more. The Bible is not a book that exists by itself. Please have some respect for the people who preserved it and delivered it to you. If the Bible were a collection of nonsense, four millennia of Jews and Christians would not have handed it down. And with it they handed down a steadily growing understanding of what it does and does not teach. Much of this understanding is written in the Bible itself. (Surprise! If you read the continuous text, rather than looking for isolated curiosities, you'll find that some parts of the Bible actually explain other parts.) More of this understanding has been handed down among great Judeo-Christian thinkers and church leaders.

If you want to argue against actual Christian teachings, then do. (Along the way, you might take the trouble to find out what they are.) Anyone who quotes the Bible to poke fun at it, without showing any awareness of how it is actually understood by the people who revere it, is just a buffoon.


[Addendum:] Let me make it clear that there is plenty of room for discussion about the extent to which civil marriage laws, or any other civil laws, should reflect Judeo-Christian morality. On the one hand, laws need a moral foundation, but on the other hand, the state cannot see into your soul, and its control over your life should be limited. My point is simply that spreading misinformation about the Bible is not the right way to further this discussion.

2012
May
8-11

Mars, Saturn, and sunspots


Click to enlarge

Here are a couple of mediocre pictures of Mars and Saturn followed by the best picture of sunspots I've ever taken, containing the biggest sunspot group I've ever seen.

Mars and Saturn were imaged on the evening of May 10 using my 8-inch telescope and DFK video camera. Each is a stack of thousands of video frames. Mars is now quite distant — about three times the minimum distance it reached a few years ago — and it's surprising that we can still record so much detail. Saturn, of course, is well placed for observation, but when I took these pictures the air wasn't very steady.

The sunspot picture was taken today (May 11) under what I thought were mediocre conditions. I used a 5-inch telescope with a Baader solar filter and Canon 40D camera; four 1/1000-second exposures were stacked. The grain that you see in the picture is mostly the real granulation of the solar surface, not a camera effect, and you can also see some faculae (bright areas).

The orange color here is artificial; the Baader filter is bluish, so I converted the image to black and white and then introduced color. I've just received a new Thousand Oaks filter that is orangeish and will not require this manipulation.

2012
May
7

(Extra)

On creating a C# style guide

Many years ago, a famous book by Kernighan and Plauger opened my eyes to the importance of style and layout in computer programming. It's not enough for the program to run correctly; it must also be written in a way that makes it easy to read and understand.

Since then, I've been involved in creating programming-language style guides twice: as lead author of this style guide for Prolog (but instead of that, please read the slides here), and more recently, when trying to create a brief personal style guide for C#.

Microsoft already publishes widely accepted style guidelines for C#. I mainly wanted to deal with situations about which they don't have much to say, such as if statements with very complex Boolean expressions (common in my kind of work).

The only point on which I really disagree with Microsoft is that I don't like what they call camelCase (that is, compound words with the first letter lowercase but the subsequent words capitalized — looking like a camel with its head down). I prefer either PascalCase (every word capitalized, the usual C# practice for nearly all names, as it was in the Pascal language) or pure lowercase.

The reason is partly that camelCase looks unnatural, and partly that it looks too much like PascalCase. If you want a visible distinction, you need more than that. In Prolog, it is very important whether a word begins with a capital letter or not, and camelCase looks enough like PascalCase to cause confusion, so we dis-recommend it. I've carried the same thought over to C#.

Actually, I can almost make it a moot point. Microsoft specifies camelCase only for local variables and argument names. In my opinion, anything local enough to fall in those categories shouldn't need a long name. I understand that inputFileNameValidationTest is easier to read than inputfilenamevalidationtest, but both of those are too long for the situations where camelCase is actually specified. How about valid or maybe validfn or at most validfilename?

But here's what surprised me. When I started discussing C# style with friends on online forums, a surprising number of them felt that (1) Microsoft has already set the standards; (2) it is a sign of depravity if a person even thinks about violating them.

People who feel that way need to think more deeply. Style guides are a means, not an end. One of the most important things about style conventions is that they should be bent or broken any time doing so makes the program more readable and maintainable.

Then there are taboos. The people who most dogmatically tell you never to code a goto statement or a public field are the people who cannot tell you why.

The same applies to dogmatic taboos in other areas of life.

2012
May
7

Sunspots!

I took this picture of the sun to make sure my equipment is ready for the transit of Venus across the sun's face on June 5. Celestron 5 (vintage 1980), Baader Mylar filter, and Canon 40D. This is the result of stacking two 1/1000-second exposures with RegiStax and then sharpening the resulting image with Photoshop. Canon Live View Shooting was used to eliminate vibration.

The blue color is artificial — the result of the filter — and a more fastidious photographer might have converted the picture to black-and-white or even tinted it orange.

This is the first time I've photographed the sun digitally. I really like working that way because my eye is never in the light path; I'm looking at the camera's LCD screen. If the filter were to fall off the telescope suddenly, I'd burn up a camera, not an eye. The filter is, of course, perfectly safe if used properly, but I always imagine the worst.

2012
May
6

"Supermoon" in super-color

On the night of May 5, Full Moon and lunar perigee coincided; that is, the full moon was about as close to the earth as it can get. This made it 14% larger and 30% brighter than its minimum. The newspapers were promoting this as a "supermoon." In fact, something similar happens every year. But here it is. The colors have been enhanced so that you can see subtle differences between different minerals on the moon.

I didn't set up a telescope for this one. I used my Canon 40D DSLR with a Canon 300-mm lens and ×1.4 converter, giving 420 mm. What you see is a stack of two exposures (to reduce camera noise). The weakest link in the optical system was actually the air, which introduced some chromatic aberration; in RegiStax, I shifted the red image up one pixel relative to blue and green to correct the problem. Then I used Photoshop to sharpen the image and raise the color saturation.

2012
May
5

On the source of the Fallacy of Sunk Costs

A common type of bad management decision is known as the Fallacy of Sunk Costs. Basically, it amounts to saying, "This was costly, so we must stick to it even if something cheaper and better is available now."

Sometimes it amounts to "throwing good money after bad" (continuing to invest in a losing proposition). Often it means keeping a piece of equipment or practice after it becomes obsolete. Sometimes it means being determined to reuse something when it would be cheaper and better to recycle the raw materials and make a new one from scratch. And a famous example from one of Mankiw's textbooks is feeling that you must go to a concert because you paid $120 for a ticket, when actually, you never promised to go to the concert; you just paid $120 for the option of going, and something could perfectly well come along that is a better use of your time.

Why do people make this kind of mistake? Partly, as many people observe, we have a natural bias to stick with what we've started, and that keeps us from being fickle. If you can't be sure, moment by moment, whether you're heading in the right direction with something, it's better not to change course too often. Changing courses introduces costs and risks of its own.

But the other day I was thinking about it, and a more important reason for the Fallacy of Sunk Costs hit me. People feel insulted if you don't use the products of their work. If you sink costs into something that involves direct interaction with a human being, that human being is going to feel unappreciated if you choose, at the last minute, not to use what you bought. Suppose, instead of buying a concert ticket, Mankiw's example person had actually hired a musician to come and play privately. That musician would feel insulted if the performance were cancelled at the last minute without a compelling reason — even if this didn't impact his pay.

I think the answer is for people to understand that such decisions are not insults. Consider the cancellation of a project in a high-technology company. Good management generally involves pursuing a project with full energy until the moment comes when it's not the right thing to do, and then cancelling it suddenly. (This is like selling an investment ruthlessly when its value stops going up.) The people working on that project are likely to feel unappreciated even if they are well paid for their labors. Unless they understand the logic of the decision, they will think management is wasting their work product.

And that, I think, is one of the flaws in the Soviet-style "planned economy." It assumed you could bring fulfillment to workers by assuring them they would always have jobs doing the same things, or at least that all changes could be foreseen well in advance. That is why, in the USSR, it was always 1930.



The inflation-housing conundrum

One surprising thing about the economic recovery has been that various efforts to expand the money supply (low interest rates, "quantitative easing," etc.) have not produced inflation. People have been reducing their indebtedness instead of increasing their spending. That means the Fed has not had to raise interest rates to curb inflation.

One thing was bothering me about this. Real estate prices are included in the measure of inflation. (Why not? Housing is part of the cost of living.) So are we looking at an illusory lack of inflation in which housing costs have plummeted while everything else might be inflating right along?

And in particular, if the promised "real estate recovery" were to happen suddenly, wouldn't it amount to sudden inflation (of housing prices), prompting changes in monetary policy?

What I now think is that the real estate recovery isn't coming. See Shiller's data here, continuing something I remarked on a few years ago. The "bubble" was a one-time thing, and house prices are now close to their long-term stable level. Of course, existing houses can rise in value even when the overall price level isn't rising, because a particular location can become more built up and desirable — or, especially in the de-industrializing Northeast, the opposite can happen! Who wants to move to Rochester, New York, right now? I'll bet the students at the Eastman School of Music are getting some real bargains on places to live.

There is still a bit of circularity; part of the reason long-term housing prices are stable (inflation-adjusted) is that housing prices are part of the inflation adjustment. But only part of it.



What's up in the sky

Jeff Duntemann summarizes what's going on. Tonight (May 5) the full moon will be a few percent larger in diameter than normal because it's closer to the earth. (The preceding and following nights are about the same.) Something like this happens every year; don't expect a spectacle. Then, in two weeks, the western U.S. gets an eclipse of the sun, and on June 5, Venus passes in front of the sun (a tiny spot visible only with a telescope; if you look at the sun, make sure you know how to do it safely!).

2012
May
1-4

The Bay of Rainbows in black and white

Despite its fanciful name, the Bay of Rainbows (Sinus Iridum) on the Moon is not a colorful place. At most, there are slight variations in the color of the lunar soil.

Unfortunately, this picture does not show them. I took it with a DFK color video camera and 5-inch telescope, stacking and combining thousands of video frames in the usual way to overcome undulations in the air that would blur the image. Alas, I chose the wrong video codec and ended up with a black-and-white recording.

Still, this is better than nothing.



Spreading malicious gossip is wrong
(even in an election year)

(The regular readers of this Notebook do not need this advice, but I'm putting it here so that people will find it through search engines, and also to suggest to my regular readers some ways of explaining this important moral principle to others.)

Did you hear that members of Congress can retire with a $174,000 salary for life? Or that President and Mrs. Obama both lost their licenses to practice law?

Those would be shocking news items except for one thing — they're not true. Yet each of them has been sent to me many times through Facebook, e-mail, and online forums.

Most people would claim to know that spreading malicious gossip is wrong. But that's exactly what you're doing if you pass along "information" like this. Somebody is spreading it in order to harm someone else, perhaps politically, perhaps some other way.

This kind of malicious "information" reaches you from a friend. No real source is mentioned; sometimes the message mentions CNN, a newspaper, the FBI, or the IRS, but there is never a web address where you can actually see the source.

The hallmark of a malicious message is that it says to "pass it on" or "copy and repost." In my experience, that's PROOF that it's false. In my 31 years on the Internet, not once has an accurate message arrived "passed along" by a friend (not the original author) with an exhortation to "spread the word." Not once.

True information has an author — someone who will take responsibility for it — and can be confirmed by looking at authoritative web sites. One particularly handy place for checking out rumors is www.snopes.com, which is very reliable. Or you can just Google the juicy item and see what other people have to say.

If you pass these things along without checking them out, you don't know who is using you. For all you know, you might be passing along al-Qaeda's or Kim Jong-Un's propaganda. More likely, people are just laughing at you. And besides that, nobody loves a gossiper.


If what you are looking for is not here, please look at previous months.