Wednesday 28 June 2023

The Square and Diagonal Lashing Analogy

Time for this year's ropework analogy!

In my time in the Republic of Singapore Navy, I've come across some truly horrible instructions about how to tie sailor knots, ranging from the misguided to the outright untrue. And some of these involve the Square Lashing and the Diagonal Lashing.

Both of these are knots meant to secure spars, or poles, or bars (indeed, any long roughly cylindrical object), to each other.

Diagonal Lashing: taken from
Art of Manliness.


Square Lashing: taken from
Art of Manliness.

No confusion there. That's straightforward enough. The misconception I often heard going around was that Square Lashings are meant for bars that cross each other on a 90 degree angle, and Diagonal Lashings are for bars that cross each other in a diamond shape.

Well, first off, that's terribly hard to quantify. What's the treshold when one should decide that the angle no longer merits a Square Lashing, and one should go for a Diagonal Lashing instead? 85 degrees? 45? Or, anything even a hair askew from a perfect 90 degree angle?

No, the real qualifier is in the angle of the forces on these two bars. For clarity, refer to the diagrams below. The arrows point to the forces that the knots are supposed to counteract.


The Square Lashing is used to prevent two bars from sliding across each other, as illustrated by the figure on the left.

The Diagonal Lashing is used when the two bars need to be prevented from springing apart, as illustrated by the figure on the right.


Taken from Scout Pioneering.

Above, you can see a sample of the standard trestle. The Square Lashings are used even in places where the bars cross each other at an oblique angle. The Diagonal Lashing is used right in the middle, where the bars have already been secured, and just need to be bound together. The angle has nothing to do with it whatsoever!

The Software Analogy

The above misconceptions occurred largely due to the naming conventions for these two knots. If you call one a Square Lashing and another a Diagonal Lashing, naturally people are going to assume that this has to do with the angle at which these two bars cross.

Similarly, bad naming conventions in programming mislead people who are reading the code. Badly-named methods, objects and variables lead people into misunderstanding their purpose based on a name.

Take the issue of splitting strings into arrays, for example. If you were using JavaScript, Ruby, Python or any number of other programming languages, you would probably use the aptly named split() function or method. In PHP, however, it's named explode() in bizarre fashion.

And how about PHP's function nl2br()? Even disregarding the wonky nature of the acronym aside, it stands for "new line to break", which implies that any string passed into it will have its new lines turned into HTML break tags. But nope, it simply inserts HTML breaks before those new lines instead.

Or, to get off PHP's case for a moment, how about inserting items into collections? In Python, you use the insert() method to add an item into a list. In JavaScript, you use push() to insert into an array. Neither of these will return a new collection!

Conversely, a well-named element can provide instant clarity regarding the intent of the programmer, or if not, at least point the programmer in the right general direction. Hopefully these examples, as well as the ropework analogies given above, will encourage programmers to do the same!

Till next time, be there or be square!
T___T

No comments:

Post a Comment