Sunday, March 08, 2009
Programmers' resources
Friday, March 06, 2009
Programming books
You may think it odd, but I've read a few programming books, in various languages. Okay, I've skipped the reference chapters, and occasionally danced lightly across other bits that I found dull, but I've read the substance of them. The first was K&R, and it was a revelation. I'd done a bit of BASIC and a bit of assembler, but my ideas of programming were largely shaped by FORTRAN, specifically Data General's FORTRAN 5. Dynamic memory allocation was a new, and fascinating, concept.
I read K&R over a weekend. It helped that it was the first (pre-ANSI) edition, and quite short.There was a time when I tried out a variety of Borland products. Turbo Pascal's manuals included an excellent introduction to OOP. Turbo C++'s documentation was very sparse by comparison. Borland C++'s documentation came on CD, with 10-volume dead-tree edition an option. I was never tempted to try to read it through. Borland C++ was vastly superior to Microsoft's product, but I've long since given up expecting the market to make rational choices. Borland continued to make innovative products. In a rational world Delphi should have wiped out VB. It spawned C++ Builder, which was in a class of its own, and JBuilder, which found itself up against some stiff competition.
But I digress. I read Stroustrup. It was hard work, but I got through it. It certainly didn't grab me in the same way as K&R (and it was a lot longer).
I wanted to like Eckel's Thinking in Java. I really did. To be fair, it's aimed at novice programmers, and covered far too much of the basics, far too thoroughly for my needs. I hadn't the patience to read it.
Next up was Perl. I read the llama, and learned a lot. It's hard to write three interesting chapters about regular expressions, but that book's a good introduction to the language. But it's still just a primer. For a full understanding of the language, you'd have to read the camel. But I couldn't. It's a good reference, but I couldn't find the motivation to read it. At this point, I have to mention Perl Cookbook. I haven't read that from cover to cover either, but it's an invaluable resource when writing Perl. (And while seeking a link for that last sentence I discovered PLEAC - I must investigate that further.)
After Perl, there were two other languages I wanted to explore (three if you count Lisp). Ruby and Python were the major contenders. At the time I was using NetBeans for Java development and NetBeans 6 came along with Ruby support out of the box. So I read The Pickaxe. Wow! This was the book I'd been looking for since K&R.
As with Eckel on Java, I really wanted to like Core Python Programming. The eight reviews on Amazon, all awarding it five stars, seemed almost too good to be true, but I felt if they were all part of a marketing exercise, somebody would have added a bad review. I'm finding it hard work.
Sunday, November 04, 2007
Respect for Flash
"And I have never seen a Flash movie that was worth waiting for."Then came Line Rider. Am I alone in thinking that the latest version has lost some of its charm? It's certainly lost some of its challenge. Now I've encountered Animator vs. Animation and its sequel Animator vs.Animation II. AvA is surely to Flash what Luxo Jr. was to rendered graphics in 1986.
These are outstanding Flash movies, well worth seeking out for their own sake. But if I'm looking for information, Flash just gets in the way.
Thursday, September 06, 2007
MIcrosoft take on the world
In my previous article, one of my major grievances concerned people's failure to use styles. Sadly, Microsoft feel compelled to revamp the user interface to styles in every major release of Word. In Word 2003, they changed the Styles drop-down menu on the Formatting toolbar to clutter it up with “styles” generated on-the-fly as well as those formally defined. This, of course, made real styles harder to find. They also relegated the modification of styles to a new pane. And even there, Modify Style… was quite well hidden.
Numbered paragraphs in Word have always frustrated me. The fact that there is an entire newsgroup devoted to the subject of numbering in Word suggests that the implementation is unnecessarily difficult. But one aspect had me baffled for years. I've often needed to use hierarchically numbered headings and, in Word 2003, I was often frustrated by the fact that I could rearrange hanging indents and margins in a numbered paragraph and apparently change a style to match the current paragraph, but the next time I applied that style, it would revert to the previous indents and margins.
A former colleague (Thanks Iain!) eventually worked out what was going on. In Word 2003, Modify Style | Format | Numbering | Customize brought up the Customize Outline Numbered List dialog, with its own tabs and indents that superseded those under Modify Style | Format | Paragraph.
Now I've moved to a new employer and, just as I was beginning to understand Office 2003, I have to use Office 2007. I can’t find the Customize Outline Numbered List dialog (or equivalent) anywhere. My new employer wants reports with hierarchically numbered headers, but also wants individual conclusions and recommendations to be numbered in a way similar to H2, without actually being H2. In particular, it looks very silly if the complete text of the conclusions and recommendations appears in the contents. I can get around this by limiting the contents to level H1, but it’s a kludge.
All of this is detail; the biggest change in Office 2007 is that they've done away with the menu bar. No, I'm not kidding. After years of writing guidelines about how the menu bar should include File, Edit, ... , Help, they've thrown away the book. This might be an improvement for users who've never used Windows, Apple's System or any Unix/Linux desktop environment. But for anyone who's used a computer in the past decade or two, it's a pain in the butt.
As I said at the start, Microsoft need change for change's sake; well actually it's for money's sake. They have to keep selling product; and when your product is software, you need to convince people that their current software is obsolete and needs to be replaced. A while back, I read in one of my employer's internal newsgroups somebody complaining that the version of Office we were using was obsolete, because the subsequent version was three years old. The implication was that software became useless because it was old, that it somehow wore out. I pointed out that the decision to replace, or not to replace, software was a commercial one. The cost of replacing software includes the costs of:
- the software itself;
- additional memory to run it;
- upgrading processors to run it;
- additional disk space to run it;
- training staff to use it;
- rewriting templates;
- rewriting macros;
- and probably a few others I've forgotten.
Running a business is a balancing act, balancing the conflicting interests of suppliers, employees, customers and shareholders. Office 2007 is perhaps the most stark example of how the interests of the shareholders can conflict with the interests of all the other stakeholders. When the business is Microsoft, it's the shareholders against a substantial proportion of the world's population.
Wednesday, March 14, 2007
Credible science
The WTF story provides a link to SCIgen, where we can read of "scientific" conferences that apparently accept papers submitted without peer review. Amusing though this story is, it points to a serious issue: if practical jokers like SCIgen can get papers published, so to can incompetents and frauds.
The SCIgen site links to a page at the Technical University of Vienna, which accuses the Wessex Institute of Technology of a similar lack of standards. It's not perhaps surprising that WIT didn't feel obliged to respond in detail to all of the accusations, given the way they were presented, but that's unfortunate, because there was prima facie evidence of a case to answer. And when WIT were making hundreds of pounds from every paper accepted for publication, they had a duty to their customers to show that their peer review process was honest.
The accusations against WIT were over ten years ago. Even if true, the events described were perhaps an isolated incident. WIT seem to have put such events behind them, until Scott A. Minnich & Stephen C. Meyer happened along. Minnich and Meyer were bright enough, and dishonest enough, to leave their silliest creationist conclusions out of their abstract. They weren't bright enough, or were dishonest enough, not to reference Nicholas Matzke's paper a year earlier that discredited their irreducible complexity nonsense. Matzke's explanation is neatly summarised here by cdk007.
Of course, conferences' review processes are subject to ineluctable time constraints. Journals can afford to be a bit more rigorous. That's why the Sokal affair was such a shock. Alan Sokal published a nonsense paper in the journal Social Text. The same day it appeared, this appeared in a different journal. When I first read that last, I was slightly puzzled as to why Sokal seemed to believe that he belongs to some coherent body called "the Left", some of whose members he thinks have let the side down. I've since learned, from ScienceBlogs and elsewhere, just how one-dimensional US politics is.
In the Sokal affair we saw how social scientists could be fooled by real scientists like us; my, how we laughed. Real scientists could never be taken in so easily. Oh yeah? The Bogdanov affair wiped the smiles off a few faces.
Notice how the Wikipedia article on the Bogdanov affair has been protected against vandalism. The controversy rumbles on. One of the major supporters of the Bogdanov brothers was a Professor Yang at Hong Kong University. Unfortunately (a) the university had never heard of him and (b) his postings were traced (by IP address) to a Paris dial-up connection. The Bogdanov brothers lived in Paris at the time.
If smart people can be awarded PhDs for fraudulent science, how much credence can we give to scientists who announce their results on the Web, on TV or in the press? At best, a rush to publication is motivated by the increasing need for academics to court funding. Fleischmann & Pons might charitaby be seen in this category. At worst, it is a sign of incompetence or fraud. Steorn are little more than a PR agency, and are not to be taken seriously. But the world's energy problems seem to attract miracle solutions. If it's not a hitherto unknown energy source, it's pretending the problems don't exist. Martin Durkin, who has a record for "selective editing" has been given airtime by Channel 4 again. His allegations are debunked at
RealClimate.
Monday, February 26, 2007
A few words about words and Word
Introduction
The following are some thoughts on writing and formatting British English. Due to restrictions imposed by my employer, it assumes the use of MS Word under MS Windows. This document was mostly written some years ago, but I occasionally get irritated and feel the need to express my views on this subject. It's been cobbled together over the years, with more thought in some areas than others.
The purpose of this document is to provoke thought and debate. We may end up with a difference of opinion, but at least it will be considered, informed opinion rather than habit.
Style guide
Introduction
This section is largely about matters of taste, rather than absolute rights and wrongs. Inevitably the boundaries are a bit blurred. Where there is no absolute right and wrong, any organisation ought to have a house style.
Gowers’ The Complete Plain Words is essential reading for anyone writing British English. Any employer whose business whose products include reports written in British English should buy a copy for every small office and several for every open-plan area. Better still, all staff should have a copy each.
Title Case (sic)
is an American invention. You won't find it in any UK newspaper for instance. This side of the pond, it is usually recognised that spaces are enough to allow readers to distinguish words. Gowers acknowledges that book titles should be in title case, but uses "sentence case" for chapter headings.
Justification
That's an odd one. Typographers deplore it but most books and all newspapers use justified text. It generally makes the page look neat at a distance, but can lead to very ugly text when long words appear in narrow columns. It can also lead to unsightly and distracting "rivers" of whitespace running down the page, especially if there are double spaces between sentences (see below).
Spaces between sentences
The notion of typing two spaces between sentences is a typist's superstition. There is some small argument in its favour when using monospaced fonts, because the full stop can appear detached from the preceding sentence. It has no place when using proportional fonts, but those who favour it will assume they are right because they know no better. It's a bit like the superstition against split infinitives in that respect.
Fonts
Organisations should set, and their employees should conform to, standards on this. I've read a lot of views on the subject, and the consensus seems to be that large blocks of text are easier to read in serif fonts and sans-serif fonts are better for headings. However, some evidence suggests that the "easier to read" is more because it's what we're used to than because of some intrinsic quality of the font face. In any case, practically all research on this area has dealt with text on paper; on a computer screen, especially without anti-aliasing, serifs are crude and ugly. Nevertheless, we should conform to our companies' standards on this.
For emphasis and headings, italics and boldface are much easier to read than underlines and block capitals.
Common spelling and punctuation errors
Apostrophes
If in doubt, don't. Gowers suggests using them when talking about individual letters, "mind you p's and q's". I would argue that the letters should be in quotes.
Capitals
If in doubt, don't.
-ise/-ize
Authorities differ. Fowler suggests using -ize whenever possible. Gowers is more pragmatic (and possibly more relevant because it's more modern). According to Gowers, in British English, -ise is never wrong, but -ize sometimes is. Hence it's easier to use -ise, but don't criticize (sic) others unless you know they're wrong.
Using Word
Introduction
Back in the early 1980s, Apple introduced the world[1] to the user-friendly drag-and-drop user interface. Corporate computer-buyers showed that they didn’t understand the most obvious economics. The price of a Macintosh out of the box was £ 1000 more than a comparable PC. The cost of training staff to use it was much less – in the medium term, the Macintosh was far cheaper than the PC. This point was beyond the myopic vision of the bean-counters.
Although it took Microsoft until 1995 to come up with an operating system anywhere near as user-friendly as Apple’s, they were quick to spot the advantages for applications, and Microsoft Office has always been easy to use. But still the bean-counters miss the obvious. The cost of training staff to use tools like Word is much less than it used to be, but it is non-zero. Pretending it is zero, and just leaving staff to get on with it, just means many more expensive hours of frustration as people reinvent the wheel, and work around Word features, because they don’t know how to make the features work for them.
Styles
This one really irritates me. It's bad enough that we reinvent the wheel with every new document, but some people reinvent the wheel with every paragraph. In a typical document, you will have a title, a hierarchy of two or three levels of heading, some body text, perhaps some bullets, and a few oddities such as references and captions. Each of these types of text should be presented in a consistent way, with a font face and size, margins, tab stops and paragraph spacing. Word provides a mechanism to define a series of styles, wherein all these features are defined. It even provides, with each document template, a series of default styles (and more factory defaults if you control-click the drop-down menu of styles). These are easily tailored to your needs (but please don't mess with your employers' templates without good reason). Please, please, PLEASE use them - they'll make your life (and mine) a lot easier.
One word of caution - I would advise against using the Normal style, because many other styles inherit its characteristics, and any changes you may make to Normal in future may have unforeseen consequences. Body Text is safer.
If anyone understands the arcane mysteries of bullets (and I would suggest bullets are only used in conjunction with styles), please explain them to me.
Cross-references
Word provides a mechanism for maintaining links to figures, tables and references in documents. It's not infallible, but it can save a lot of very tiresome editing.
Track changes
This is a useful way of putting comments and suggested changes into other people's draft documents.
Fields
These are useful for embedding boiler-plate text, such as the document title, as well as formatting things like page numbers. Right-click on a field (usually shaded with a grey background) and select "Toggle Field Code" to see the field codes - this is often useful when your page numbers are going screwy.
“Keep with next”
All heading styles should have this option set. Widow/orphan protection on body text is quite useful too.
Miscellanea
File names
Windows, and Windows applications, are inconsistent in their handling of spaces in file names. To keep life simpler, it's best to avoid them, especially in folder names.
What's the singular of "miscellanea"? "Miscellaneum"?
[1] Yes, I know it was invented at Xerox's Palo Alto Research Center - but they did nothing with it.