LETTERS

C++ Event-Driven Threads

Dear DDJ,

In his excellent article "Event-Driven Threads in C++" (DDJ, June 1995), Dan Ford mentions that since "several of the methods [of the QThread class] are pure virtual...we must provide an implementation for them in the derived classes." While this is true within the context of the article, I've always found it a bit misleading to put it this way without further qualifications. Many people I've run into think that if a method is pure virtual, not only must derived classes provide an implementation (which is false), but also that the base class cannot provide a default implementation (which is also false).

In their book C++ FAQS, Marshall P. Cline and Greg A. Lomow get the latter wrong in one spot (though [they] later unselfconsciously correct it), where they assert "there is no way to implement [a pure virtual] member function in [an abstract] base class."

A derived class must provide an implementation of a pure virtual function only if one wishes to instantiate the derived class. For example, suppose class A declares a pure virtual function void foo()=0;, class B inherits from A providing no implementation for foo(), and class C inherits from B and does provide an implementation for foo(). All this means is that B is still an abstract class which cannot be instantiated, though C can. Class A could provide a default implementation for foo(), which could be used in C, or in any other derived classes, for that matter.

Though, as Scott Meyers notes in Effective C++, this feature of the language is "generally of limited utility," it can be useful, for example with pure virtual destructors providing default cleanup behavior, which is inconvenient to offload to nonvirtual functions.

Bill Lear

Lear Software

rael@world.std.com

Dan responds: Thanks for your comments, Bill. You make a good point regarding the implication of my statement about pure virtual methods (even though, as you point out, it is true in the context of the article). In an article of that length, it is usually not possible to explore all the possible consequences of various design and implementation decisions. Perhaps the paragraph would have been clearer if I had pointed out that since the QThread class did not provide an implementation for the methods, it would be necessary for concrete classes derived from QThread to provide implementations.

Park It

Dear DDJ,

After reading Jonathan Erickson's "Editorial" (DDJ, June 1995), I'm going to have to add the special infrared flashlight that lets me stay in the parking place but feed coins. We already use radar and laser detectors and jammers.

Hmmm. A high-intensity infrared beam.... "Terrorists attacked the parking meters at city hall this morning, causing general havoc, and permitting the public to park freely for over two hours. Loss of revenue was devastating...." Now, let's go a step further. That infrared sensor might just be able to read a digital signature on the car. And while you're at it, instead of plugging in more cash, maybe it could just charge my account. Betcha I'll have a fourth box on my dashboard that transmits the digital signature of the Governor's car. Of course, people will get suspicious when the Governor is parked at ten different parking spaces at the same time.

This really isn't too far-fetched. But the privacy implications could be a problem. You can already get traced via some pagers, as well as cell phones, credit cards, and follow-me phone numbers. Tracing your car would just add one more tool to Big Brother's arsenal. Kinda scary as a person, but kinda cool as a gweepoid unit. We developer types like to have explicit control over the things we can control.

...click...

Nelson Crowle

ncrowle@tyrell.net

Will the U.S. Have an Internet Future?

Dear DDJ,

Jonathan Erickson's "Editorial" about the Internet (DDJ, May 1995) raises many concerns about the future of Internet in the United States. Let's suppose that Senator Exon's bill about making node operators liable for "indecent contents of messages" passes. Operators will demand release contracts from everybody that talks with their machines, users and other nodes alike. Then, they will only pass on messages from "trusted" people, that is, people whom they have contracts with. It will be the end of Internet for all practical purposes in the United States. It will be as complicated and expensive (or more) as CompuServe and the future Microsoft Network. Well, those are two big beneficiaries of such a law besides the lawyers....

But of course, Internet is now large enough to survive the loss of its backbone, the United States. Certainly someone else will pick it up. Maybe Japan, maybe Europe. Maybe the U.S. Supreme Court will end up deciding that the law does not apply to Indian Reservations and we will have "IndianNet" instead of Internet.

Mauro Sant'Anna

Sao Paulo, Brazil

mauro.santanna%mandic@ibase.org.br

Julian Dates

Dear DDJ,

In his letter on Julian dates (DDJ, June 1995), Homer Tilton states that "...when the astronomer says that his 'Julian Day'...relates back to January 1, 4713 bc, he doesn't tell us what calendar he is talking about!" This just isn't true. From Explanatory Supplement to the Astronomical Ephemeris and the American Ephemeris and Nautical Almanac, 1974 reprint (p. 71):

To facilitate chronological reckoning astronomical days, beginning at Greenwich noon, are numbered consecutively from an epoch sufficiently far in the past to precede the historical period. The number to a day in this continuous count is the Julian Day Number which is defined to be 0 for the day starting at Greenwich noon on b.c. 4713 January 1, Julian proleptic calendar.

Murray Lesser

Yorktown Heights, NY

Murray.Lesser@f347.n109.z1.fidonet.org

Image Authentication

Dear DDJ,

While Steve Walton's techniques for embedding a "seal" of authenticity in an image are quite clever ("Image Authentication for a Slippery New Age," DDJ, April 1995), one question remains unanswered: How does the author of an image enable third parties to verify the seal, without giving away any other abilities?

Walton's seal is based on a traditional authentication code, where both the creation and the verification of the code require knowledge of a secret key. Thus, giving a third party the ability to verify a seal also gives the ability to create new seals.

One way out of this problem is for the author to seal each image with a different secret key, but this can be complex to administer. Another solution is digital signatures: Seals are created with a private key known only to the author, and verified with a corresponding public key that can be given to anyone without revealing the private key. The RSA public-key cryptosystem and NIST's Digital Signature Algorithm both provide this kind of functionality.

Embedding seals is one issue; enabling other parties to verify them is another. Digital signatures combined with Walton's techniques can provide good solutions to both requirements.

Burton S. Kaliski, Jr., Chief Scientist

RSA Data Security

Redwood Shores, California

Steve responds: Dr. Kaliski has stated very clearly the entire solution to image authentication, including good methods for third-party verification. The algorithms which I proposed are intended as a way of embedding any sort of data into an image in an undetectable way. Illustrating this with a checksum scheme was a simple and, judging from the response, clearly understandable environment in which to tinker with the methods. By embedding digital signatures encrypted using RSA or whatever will succeed it in the next generation, the problem of determining the veracity of images is completely and conveniently solved. A final comment for those of you interested in other forms of data: By adding a slight amount of controllable noise (if it's not already present), any stream of data can be protected in precisely the same manner. For example, music, voice recordings, telemetry, executable software binaries... fill in your own blank!

Fluid Thoughts

Dear DDJ,

In his "Programming Paradigms" column "Fluid Concepts and Creative Analogies" (DDJ, June 1995), Michael Swaine mentions a program called "Seek-Whence," which is supposed to find the next number of a given sequence, say, 1,2,2,3,3,3,4,4,4,4,.... The "definite" answer is 5, as given implicitly at the end of the article. However, I claim it is 4: one 1, two 2s, three 3s, five 4s. Why? Because 1, 2, 3, 5 is a part of Fibonacci sequence. In fact, I can claim whatever number I like as the answer by using Lagrange interpolation function (take the integer part if you insist that it produces a sequence of integers) as the rule. The point is, there is no definite rule whence a sequence came, and there is no definite answer to "puzzles" like that. So what exactly does "Seek-Whence" do? I cannot tell until I read Hofstadter's book. Let me ask this question: Given the sequence 1,2,3,4,5,..., what makes 6 a more convincing follow-up than, say, 7? I feel that it is rather an illusion than anything else. I hope this is addressed in detail in Hofstadter's book, although it is unfortunately left out of Michael's column.

Huayong Yang

yang@math.umass.edu

Dear DDJ,

Michael Swaine's column on "Fluid Concepts and Creative Analogies" was very interesting. However, I have a question concerning one of the next terms under the section titled "Seeking Whence." The string of terms in question was: 3,5,11,17,31,41,47,59,....

The given solution was p(p(n)); the (nth prime)-th. The second prime, the third prime, the fifth prime, the seventh prime.... However the just mentioned string does not fit the solution:

The prime numbers:

2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,57,59,61,67,71,73,79...

2nd prime = 3

3rd prime = 5

5th prime = 11

7th prime = 17

11th prime = 31

13th prime = 41

17th prime = 57, not 47

19th prime = 61, not 59

Therefore, the new series should be 3,5,11,17,31,41,57,61,... with the next term of 79 the 23rd prime. Is this not correct?

Dwight Keeve,

Columbia, South Carolina

DwightK848@aol.com

TrademarkTM

Dear DDJ,

I particularly enjoyed Jonathan Erickson's "Editorial" in the July 1995 issue of DDJ. In fact, my wife commented that I had a pronounced smirk on my face as I read it. I guess I just could not help myself as I became amused while reading about how Microsoft was going after an independent programmer just to set a precedent in a trademark dispute. I suppose next they will launch a campaign to sue everyone in the U.S. named "Bob" for trademark infringement. This could be so widespread that Microsoft could possibly lessen the burden by assessing a flat-fee for all "Bob-offenders." Hey, maybe they could even make it part of their '95 tax returns. After all, it seems that the present administration is pretty sweet on Mr. Gates, and neither Bill nor Bill will have to pay--their names aren't "Bob." I question why Microsoft didn't name their new interface "Bill" instead.

I would like to make a prediction. I have noticed that Microsoft has begun offering a developer's software package that includes Office 4.2, Visual C++/ Basic, FoxPro, and a few other goodies. I also noticed that Microsoft is making their move toward subscription plans with the developer's platform subscription (you know, the one that Microsoft Tech Support answers every developer question with: "What you need is the developer's platform level 2 subscription for $499 a year, the Microsoft sales number is 1-800....") and the Visual C++ subscription. If you put these all together, in the next year Microsoft may begin offering a Home/Office PC Software Suite. This suite will be a one-time purchase where you get Windows 95, the 32-bit office suite (5.0?), Quicken, Microsoft Network, Microsoft Mail, and Microsoft Publisher. Microsoft will market this as a great "one-time investment" just like buying a package-deal computer from companies such as Dell or Gateway. I suppose the price will be around $1000-$1200, but since you only have to buy it once....

The company could also offer a subscription for a nominal fee of, say, $400 a year to get four quarterly releases of the latest software on CD as well as a number of free hours per month on the Microsoft Network. That way, the average user will always be using the latest and greatest software, and the biggest advantage is that all the headaches of continually purchasing upgrades are gone. It's like one-stop software shopping for home and business users. An added advantage is that file-format incompatibilities would no longer be an issue. If everybody uses Word and Excel, then nobody has to worry about converting files to another word processor or spreadsheet format when they want to share their files.

This would pose a great threat to other companies like Lotus and Novell, as Microsoft could potentially take over the remaining market share (not that they don't already dominate). In fact, Microsoft could become so big that they would be much like AT&T/Bell before the Federal deregulation. Hopefully it won't go that far, but I know Microsoft's marketing team (I think they are about the best around) has big dreams--they just haven't revealed them all to the rest of the world yet.

Of course, everyone I've mentioned this idea to so far has responded with extreme skepticism. But I'm just putting two and two together. One of my coworkers even suggested that Microsoft would get slapped with antitrust lawsuits. I don't think that would happen, since the up-front sale constitutes a single purchase, and the subscription would be viewed as a software-support agreement. Some of the big UNIX software suppliers do it every day (HP, SunSoft, SAS, Frame software, and others).

Troy M. Noble

Colorado Springs, Colorado

71744.3311@compuserve.com


Copyright © 1995, Dr. Dobb's Journal