The Right Tool for the Job

On the The Unix Heritage Society mailing list, someone started a
thread commemorating the death of John Backus, who, in addition to
inventing the Backus-Naur form, lead the team that developed the
original FORTRAN. Someone else made a disparaging remark about FORTRAN
and that precipitated a long discussion of the good, the bad, and the
ugly of FORTRAN. Most people who’ve never used FORTRAN—and many who
have—aren’t aware that except in strings and a couple of other places,
blanks don’t affect the syntax and can be omitted. I recall once
looking at a FORTRAN compiler where the first thing it did after
reading a card image was to eliminate all the blanks.

Steve Johnson, the inventor of Yacc, the Portable C Compiler, and
Lint, offered a funny story about FORTRAN and blanks at Bell Labs. His
post is worth reading as an interesting piece of Bell Labs history but
what struck me was how the choice of the right tool for a job enabled
Johnson to complete a task much more quickly than even the world-class
engineers and computer scientists at the lab expected.

The TL:DR is that Johnson, just out of college, had a summer job at
the labs. He was assigned to write a program implementing a state
minimization algorithm. His supervisors expected it to take him the
summer to complete the program. But Johnson had heard about this new
language, SNOBOL, that seemed perfect for the task. Once he got SNOBOL
running, it took him only 3 weeks to do the job.

All of us have go-to tools that we turn to first. In terms of
languages, it might be C, Lisp, Python, Ruby, JavaScript, R, or
whatever we’re most comfortable with. But stopping to consider what
tool will make the job easiest can yield large dividends.

Posted in General | Tagged | Leave a comment

Programmers and Hardware

The other day I followed a reddit link to a blog post about forking on
GitHub. I didn’t find the post that interesting but I did find one of
the comments on reddit provocative. Chrisgseaton takes exception to
the notion that “real” programmers have to think about hardware1.
As far as I can tell he wants to think of his programs as running on a
virtual construct that implements a logical model but—ideally—with no
actual hardware underneath.

That’s often a useful model and I don’t consider programmers that
adhere to it “lesser programmers” but I do think that great
programmers always have the underlying hardware in mind. Not
necessarily the actual piece of hardware the program will run
on—because, really, how can you know—but at least some sort of
idealized piece of hardware2.

That sounds almost like the “logical model” that chrisgseaton wants to
think about but it’s really a bit more. Every architecture that I’ve
ever worked on has load, store, arithmetic, and some sort of logical
if commands. Their mnemonics and exact operation will differ, of
course, but to a first approximation they’re the same.

That means that as I code I can imagine—again to a first
approximation—what code will be generated. If you can do that, you can
make intelligent decisions between functionally equivalent ways of
coding an idea. If you can’t do that, I don’t see how you can hope to
produce the best code.

I may feel that way because most of my professional development was
done in C, which is often considered a “high level assembly language.”
On the other hand, I can mentally imagine the final machine code even
when I’m coding in a language like Lisp. Languages like Python are
harder because they’re running on virtual machines but even there it’s
possible to predict what “code” will be generated.

So for me, yes you do have to think about the hardware as you code.
Of course, that’s just me. What do you think?

Footnotes:

1

You may have expand all the comments to see his comment.

2

As a practical matter, though, the majority of developers will
have some sort of x86 architecture as a target. Those developers can
have a fairly specific machine model in mind.

Posted in General | Tagged | Leave a comment

Emacs Über Alles

I’ve written before about EXWM and its use as a window manager for
systems running on X Windows. The basic idea is that Emacs becomes
your windows manager and other applications run in an Emacs buffer.

That’s a boon for those of us who strive to spend as much of our tube
time as possible in Emacs. It’s pretty easy—at least it was for me—to
get all your frequently used application functionality, except for your
browser, under Emacs. With EXWM, you can have even your browser—your
real browser, not eww—run in an Emacs
buffer.

If you’d like to see it in action, Uncle Dave has a video that
demonstrates setting up and using EXWM. It’s a little finicky to set
things up but once you do it runs just like any other window manager.

I’d really like to try it out but, sadly, it only runs under X Windows
and I’m on a Mac. If you’re running a Linux machine, it’s easy to try
it out because it’s just another window manager and you aren’t
committing to a long term relationship with it. It’s possible, as
Uncle Dave’s video shows, to change window managers when you log in.

I don’t think that EXWM is the perfect end state but it comes close.
What I’d really like is to be able to run a browser in Emacs. That’s
being worked on so perhaps we’ll see it before too long. In the mean
time, EXWM is an excellent solution to bringing everything under the
Emacs umbrella.

Posted in General | Tagged | Leave a comment

Why C?

Even though I mostly program in some form of Lisp these days, the
majority of my programming over the years was in C. That’s not hard to
understand: most of my work involved low level communications software
such as radio network controllers and message switches. Not very long
ago, C was used for virtually everything—even things for which it
wasn’t really suited.

These days, C use tends to be restricted to its more natural role as a
language for systems programming and specialized applications where
speed is essential. Even in those niches, C is feeling pressure from
languages like Go and Rust. Many younger engineers have never used C and
are inclined to think of it as a crusty, old language whose time has
passed. Pretty much like the programmers of my generation viewed, say,
COBOL.

Still, C is far from dead and is still the language of choice for many
types of programming. It has a lot going for it: it’s fast, doesn’t
require a run-time engine, and can even get by with a very small
run-time library. The folks over at the SQLite Project have a page in
which they explain why they still use C and have no plans for
changing
.

In addition to the reasons above, the SQLite page also calls out C’s
stability. The very fact that it is an “old” and established language
is a plus for them because the developers don’t have to worry about
the language changing out from under them in the way that a new
language still undergoing development—such as Rust—does. C is still
evolving, of course, but very slowly and always with an eye on
backward compatibility.

Posted in General | Tagged | Leave a comment

It Can Be Done

The Dutch people have done a remarkable thing and as such serve as an
inspiration to the rest of us. This week the voters rejected a bill
that would have given the government sweeping powers to wire tap their
citizens communications and to retain and share the captured data with
other intelligence agencies. The vote was fairly close with younger
voters providing the edge to the no vote.

It remains to be seen, of course, whether the government will, as they
promised, respect the vote or will mumble the usual “national
security” code words as an excuse to break that promise. The vote
itself is legally non-binding so the government has some wiggle room.

Regardless of the outcome, the Dutch people have shown the rest of us
that it is possible to get past the usual Four Horsemen of the
Infocalypse
scare tactics and insist that the government respect the
law and their citizens’ privacy. We could use a little of that in the
U.S. but, you know: Terrorism! Child Porn!

I hope, but don’t really expect, that this will inspire folks in the
U.S. to similarly insist that our laws and privacy be respected. I’m
sure that those of you in other lands feel the same.

Posted in General | Tagged | Leave a comment

A Reasonably Safe Windows Email Reading Environment

If you are unfortunate enough to work in a Windows/Outlook/Exchange/MS
Office/Adobe/Flash environment, you know that you are constantly at
risk of being infected with email viruses. Needless to say, no system
is completely secure but there are safer alternatives. Of course, if
you’re in that environment it’s probably because you work for an
organization that insists on it so you don’t have the option of moving
to something safer.

Karl Voit is in that situation and has developed a reasonably safe and
sane way of dealing with email
in it. You should read his post for the
details but the TL;DR is that he set up a virtual environment on his
Windows machine that runs an instance of Debian Linux. That instance
gets mail from Outlook on the Web and reads attachments using a
hardened PDF reader (Ocular) and LibreOffice for MS Office files.

Is it 100% safe? Of course not but with a little care you can avoid
most of the problems. Voit took pains to make the environment simple
to use and familiar for Windows users. Having been Windows-free for
decades, I haven’t used his setup but it looks very nice and Voit
appears to have addressed the weak security spots.

If you are someone you know is stuck with an insecure email
environment, take a look at Voit’s post and see if his solution will
work for you. It’s bound to be safer and it doesn’t appear to be
terribly inconvenient to use.

Posted in General | Tagged | Leave a comment

Calc For Programmers

After writing about Florian Adamsky’s post on acronyms in AUCTeX,
I snooped around on his site and came across a nice post on Emacs Calc
from a programmer’s and computer scientist’s point of view. As regular
readers know, I’ve been working to increase my calc-fu lately so I
read the post with interest.

Adamsky demonstrates some of the Calc functions that are useful to
programmers and computer scientists. This includes such things as
entering and displaying numbers in various radixes and performing the
standard logical operations on (the usually binary representation
of) numbers. He even shows how to add a new “units” representation to
Calc—in this case bits/bytes/bits per second.

Calc is a large subsystem and famously hard to master but worth the
effort. It’s been described as a “poor man’s Mathematica.” It’s not
nearly as powerful as Mathematica, of course, but it’s surprising how
many things it can do. If you’re a programmer/computer scientist and
an Emacs user you should spend a little time investigating Calc. It
really can make your life easier. An easy way to get started is to
read Adamsky’s post. It covers only a small slice of Calc but will
give you an idea of its power.

Posted in General | Tagged | Leave a comment

New Release of Org Mode

Bastien tweets that there’s a new Org mode release:

It’s already available in Org ELPA repository
(https://orgmode.org/elpa/) so you can install it at your leisure.

Posted in General | Tagged , | Leave a comment

Acronyms in LaTeX Documents

Florian Adamsky has a very nice post on handling acronyms in LaTeX
documents
. Good style dictates that the first time you use an acronym,
you should provide the full written out definition. Later instances
can just use the acronym. That’s pretty easy to do with a small
document but for larger documents where there’s a lot of editing and
restructuring, the definition may get moved so that it comes after a
use of the acronym by itself.

Fortunately, there’s an excellent \(\mathrm{\LaTeX}\) package that
handles all this for you and Adamsky shows you how to use it. One
problem with the package from Adamsky’s point of view is that you have
to list the acronyms and their definition at the beginning of your
document. That makes it inconvenient to add a new acronym where you’re
in the middle of the document. To solve that problem, Adamsky wrote a
bit of Elisp that lets you add a new acronym on the fly without losing
your position in the text.

If you write in \(\mathrm{\LaTeX}\), you should check out the acronym
package. It probably won’t make a huge difference in your workflow but
will help remove one annoyance. You will probably also want to grab
Adamsky’s code so that you can add acronyms to the table as you need
them.

Posted in General | Tagged | Leave a comment

RC1 for Emacs 26.1

Eli Zarestskii has announced that barring any difficulties coming to
light, the Emacs 26.1 RC1 should be released next week. Zarestskii
expects that that will be followed in short order by the release of
Emacs 26.1 itself.

Relative newcomers to Emacs will see this as simply the usual yearly
release that has become standard for software in our industry. Those
of us who have been around a bit longer know that it wasn’t always
this way for Emacs. Major releases could be years apart and came when
they came. Thanks to recent maintainers—especially John and Eli—we now
have a more predictable (and frequent) release schedule.

It’s good to remember that this is a lot of hard work and it’s all
done by volunteers. Guys like John, Eli, and the other contributors
have families and real jobs that need attending to but still make time
to keep the Emacs project going and flourishing. We all owe them a lot
of thanks.

Posted in General | Tagged | Leave a comment