Are some people just clueless?

I don’t profess to love technology, in fact I am very wary of it. I do enjoy programming, and I realize that computers aren’t going away anytime soon. So it saddens me then when people within universities have no clue whatsoever that one of the top growth areas is computer science. Why? Partially is because it’s relevant. Students who do CS get jobs. Good paying jobs. It’s hard to find a job, in the sciences anyway, that doesn’t require some programming skill to process the vast amounts of data being produced. We have come to the point where it is hard to ignore computer science education.

Here’s the bottom line. CS enrolment in most places has ballooned in the past few years. At Cornell, their enrolment has gone from 175 in 2011 to 684 in 2016. In fact institutions across North America have seen doubling and tripling of CS enrolments in the past five years. Just a little blip really. Nothing at all provocative about those numbers. On the there side of things, Canada’s demographic is changing – over the next 10 years the number of 17-24 year old will actually decline. Less students = less government funding. This could be offset by increasing enrolment is CS, OR by offering new forms of degrees – 4 year coop?, more 3 years degrees, industry-focused degrees etc.

The worst thing to do? Ignore computer science. Put no effort into building innovative degrees, or investing in infrastructure.

Innovation needs computer science. But apparently not everyone understands that.

 

 

Usability and online reviews

You can learn a lot about the usability of an object from other peoples observations. This is true even if there isn’t a specific usability analysis that has been developed for the object. In fact, as is often the case, the best observations are made by people “at arms length” to the design and development process. Take for example, the case of the TREAD, a wearable multitool made by Leatherman. This multitool, in the form of a bracelet, has 29 tools squeezed into nine-links, and a watch-like clasp. Select the tool, and fold the rest back to form a handle. Seems like a good idea right?

leathermantread

The TREAD contains various tools: a bottle opener, a line cutter, a carbide glass breaker, an oxygen tank wrench, a SIM card tool, a ¼” socket drive, 6 box wrenches, 8 hex drives, 5 flat screwdrivers, a #2 square driver, and 3 Phillips screwdrivers. In Canada its selling for C$165, so not exactly cheap. But what do the online reviews say about the TREAD? Here are some of the more critical reviews from the Leatherman website, and Amazon.

  • “All the tools start to get deformed for normal wear and tear within the first 6 months of wearing it. Also the screws self loosen the more you wear it.”
  • “Very cool product, incredibly bad developed.”
  • “This bracelet costs more than it is worth in usefulness.”
  • “The aggressive angle make the flat bits useless. They will pop out of the screws you are trying to tighten or loosen and you won’t be able to put any torque on the screws at all.”
  • “Most of the Philips and flat head bits are so mangled from wearing it everyday that they are not very useful anymore.”
  • “An expensive solution to a simple problem”.
  • “The best choice in limited circumstances”.

Most users agree that the concept is great, but the design is flawed. It is aesthetically pleasing, but the tools are either not that rugged, or versatile. The selection of tools is also slightly flawed. It’s unlikely that anyone would need five flat screwdrivers, and the device lacks any Torx screwdrivers. Many of the complaints centre around the inability of the clasp to function properly, or the screws which hold the bracelet links together coming loose (a common complaint). Guess what you need to tighten them, or remove unused link to adjust the size? A separate screwdriver, or their suggestion, a penny.

leathermantread2

SIM card remover? How often does one need to do that? It seems like the tool doesn’t know what it is? Is it for fixing a bike, or swapping SIM cards? An oxygen tank wrench? The average person has no use for that. Engadget calls the TREAD 29 kinds of dysfunctional.  There are plenty of good reviews, however many of these merely talk about the “great functionality”, or how cool it is, e.g. “Tread is simply the coolest tool in existence”. Here is the summary from the Leatherman website. Kudos to Leatherman for publishing the cons identified by the users as well.

leathermantread3

For a review of the TREAD, check out this article.

Programming blunders

The word “blunder” is one of those nice words  which means is a spectacularly bad decision or action. I have seen it used in “The Elements of Programming Style”, and feel that some programming faults are probably more aptly termed blunders. Things that you didn’t really mean to happen, they just did, and they usually aren’t all that hard to fix.

Let’s consider first a program to calculate the harmonic series:

harmonic

To implement this equation would require an upper bound n, and a loop of some sort. Consider this code in C:

double harmonic;
int k;
for (k=1; k<=n; k=k+1)
    harmonic = harmonic + 1.0/k;

This simple program should work, if properly coded, but there is a small problem with this code. Can you see it? Look at the value of the variable harmonic inside the loop. It seems to be a successive sum of the various components of the harmonic series, up until n. But what happens when you run this program with the n=4. You get a result, which doesn’t exactly look right. Now try doing the math on paper, and compare answers.

If you now look through the code, you will notice that the variable harmonic has never been given an initial value. This is not a problem for most compilers, who will just assign harmonic a garbage number. This will be the initial value onto which the values of the harmonic series are added.

Should the switch statement exist?

One of the more controversial things about some new languages such as Julia, Python and Lua is that they have done away with the switch/case statement. Some see this as a limitation of the language, but others, like myself see it as evolution, similar to the human body spurning the appendix – may have been a good idea once, but is it even needed anymore. It would be one thing if the functionality of the language was seriously impacted, but in languages such as C, the switch statement is often more of a burden than anything else. Switch and its brethren evolved from the select-when statement of PL/I in the mid 1960s. Its structure looked like this:

select;
    when (C1) S1;
    when (C2) S2;
    when (C3) S3;
    otherwise S4;
end;

This was likely easier to interpret than it’s modern rendition. But as time progressed, the case statements evolved into complex beings, with the most handicapped form likely being that of C.

In essence, anything a switch/case statement can do can be achieved using a standard if-else statement, especially if the statement incorporates the shortcut elseif (of elif, elsif etc). The issue for novices programmers of course is “Why should I use the switch statement”, or “Is switch better?”. It is hard to answer these questions. For novice programmers, the use of a structure which in effect performs the same function as another is confusing. Never mind implicit fall-through.

So leaving out the switch statement in a language is not a bad idea, especially from a simplicity point-of-view.

switchexist

The other trick is that in C there is no clear way of deriving a switch statement from:

if (x > 0)
    printf(“positive”);
else if (x < 0)
    printf(“negative”);
else
    printf(“zero”);

This occurs largely because there is only one branch of this statement with a distinct  value, the last one where x equals zero. Positive numbers go from 1 to infinity, so naturally you see the problem (Is zero positive? that’s likely a philosophical question). Languages such as Swift have taken another approach and modified the switch statement to allow multiple cases on the same line, or ranges. Still doesn’t solve the above problem. But then again having a structure like this:

select
    when (x>0) print(“positive”)
    when (x<0) print(“negative”)
    otherwise  print(“zero”)
end

May be all but redundant with the existence of if.

 

Programming syntax and its analogy with English (ii)

The loop constructive REPEAT means “do something again”, implying it has already happened once. The keyword FOR does not actually have a meaning that has anything to do with repetition. In programming it is all to do with setting the sequence of values for a variable, and then using them in some manner in a sequential manner. However for could just as easily be used in this context:

for x = 3.1794

But reading this implies that x is assigned the value 3.1794. There is nothing in the definition of for that would suggest it could do repetitive things, it was only really implemented as the English translation of the German word für. In this respect maybe Fortran’s use of the keyword DO was more appropriate, or even LOOP. The use of do at least implies an action. That may be what confuses the novice programmer.

do i = 1:100
loop i = 1:100

The for loop might be clearer in the following context:

for i = 1:100 do

What is clear is that the continued use of some keywords lies more in historical context than anything else. We are comfortable using for as a loop, and any other suggestions are considered  ludicrous, even though Fortran continues to use the keyword do, and Cobol the keyword perform.

A similar scenario exists with the switch statement. A switch implies making a decision, similar in concept to the railway switch, where only one track is active. It does not have the same distinctness as the case statement, as in “ case x of ”. Here the select statement of PL/I makes much more sense.

select;
    when (C1) S1;
    when (C2) S2;
    when (C3) S3;
    otherwise S4;
end;

Some of this is made more difficult by the expressive nature of the English language, stemming largely from the theft of words from other languages. For example the two words if and when. The latter was sometimes used in early languages but has disappeared from use. What is the difference between if and when? The word when is of German origin, stemming from the German wenn, meaning if.

when x > 0

Never trust software

For the past while I have noticed that my MacBook Pro has been getting quite hot on its underside. Now this machine is only 7 months old, so it seemed kind-of weird. I spent a few days trying to google similar problems, with the usual suspect – hardware the forefront of most online discussions – not enough circulation, internal fans running too slowly, blah, blah, blah. Then this morning I noticed that it seem to get hot about 3 minutes after opening the laptop. Further investigation and a lucky google search led me to use the activity monitor, with the idea being that one or more processes was hogging a CPU, and causes it to overheat. Low and behold, what do I find? The culprit is “Google Chrome Helper”, not one instantiation, but multiple ones – hogging anywhere from 15-70% of CPU cycles. So I started killing the main CPU eaters, and the heat dissipated.

So it was software causes my issues. What this Google Chrome Helper does is anyone’s guess, but I managed to fix it by killing all the Chrome browser windows, and then going into advanced preferences, and setting Privacy→”Content settings”→Plugins to “Let me choose when to run plugin content”. Problem solved, machine cool, user happy.

It still bothers me that this is an issue, and it goes to show you can never really trust software.

Programming syntax and its analogy with English (i)

One of the problems with the structure of programming languages lies in its choice of English words for syntax, partially because they can be misleading.. From an early stage in the evolution of programming syntax the choice of keywords in a language has been focused on words that suggest something about their effect: PRINT, READ, WRITE, REPEAT. For instance the use of PRINT likely evolved because the early programs output to teletype machines as opposed to the screen. Many of these words have evolved into common use, however to the novice programmer, some may have more than one meaning.

Let’s consider the keyword if, commonly found is nearly every language to actuate a decision statement. In the dictionary, it is either a conjunction or a noun. As a conjunction it introduces a conditional clause.

if it is raining, open an umbrella.

Yet it can also be used to express surprise, as in “Well, if it isn’t Obi-Wan Kenobi”. Is there a better word for a conditional? What about whenever? assuming? or even while? Let’s consider an example piece of code.

whenever (x > 0)
    r = sqrt(x)

This doesn’t work so well, because whenever implies “every time that”, which seems more like its associated with some repetitive structure (similar to while). The keyword assuming might work equally as well as if, but only if used in combination with the keyword then. So the key to understanding syntax might be the interplay between different keywords in a control structure. The classic is of course if-then-else, which if often expressed as if-else in languages such as C. Part of the reason these combinations have been successful may be their brevity. Imagine if alternate words had been used:

assuming (x > 0) it follows that
    r = sqrt(x)
otherwise 
    r = 0

Just as readable, but more verbose. Could have worked well in Cobol, but contemporary programmers don’t like verbosity (this is the feedback I have received from numerous students when confronted with programming in Cobol). In any case, the use of a complete if-then-else sequence would likely make it easier for novice programmers to understand the context and scope of a decision.

if (some_condition) then
    perform an action
else 
    perform an action
end

 

 

Miracles You’ll See in the Next 50 Years: A retrospective

In February 1950, Popular Mechanics ran an article titled “Miracles You’ll See in the Next 50 Years”, written by Waldemar Kaempffert, the Science Editor of the New York Times. How many of these prophecies came true by 2000? Let’s look at a few of them. In the article, Kaempffert describes a hypothetical town of 100,000 – Tottenville. This Eden-like community seems to offer it all – a clean, quite environment surrounded by green open spaces.

miracles50years

Most power is provided by solar power. FALSE – globally maybe 1% of power is provided by solar power. Certain smaller countries (e.g. Denmark) have made great strides, and with the advancement and cost reductions, solar will make a larger impact in the near future.

Atomically driven ocean liners. FALSE – There are still a few aircraft carriers and similar warships driven by nuclear power, but no ocean liners. This went the way of atomic trains.

Light metals have displaced steel. TRUE (kind-of) – light metals are becoming more common, but steel is still heavily used in construction, partially because it is cheaper than lighter metals.

By 2000, wood, brick and stone are “ruled out” as building materials because they are too expensive.  FALSE – In fact wood is making a comeback, especially in the form of laminated wood products, which are often just as structurally sound, and much greener than metals. Wood is now seen by some as the “building material of the future”.

The houses are galeproof and weatherproof, but only designed to last 25 years. “Nobody in 2000 sees any sense in building a house that will last a century”. TRUE and FALSE – True, in that gale-proof house can be built, although they are often costly. False, in that nobody designs houses that will only last 25 years – inadvertently however some people do construct houses of inferior materials/design that likely won’t last very long.

Everything in the house is synthetic. There are no dishwashers. Dishes are “thrown away after they have been used once, or rather put into a sink where they are dissolved by superheated water”. The plates are made from raw materials such as cottonseed hulls, oat hulls, Jerusalem artichokes, fruit pits, soy beans, straw and wood pulp. FALSE (sort-of) – Many things in our houses are synthetic, although there is a movement back towards natural products. Thankfully dishes are not thrown away after use, although there are companies making plates etc out of biodegrable products.

Furniture, rugs etc. are all made of synthetic fabric or waterproof plastic, and can be cleaned using a hose. FALSE – It is possible to buy things that could be cleaned with a hose, but that is usually for outdoor use. Thankfully no-one thinks using a hose to clean their house is a good thing.

Food is dominated by the frozen food industry. Electronic stoves that can prepare a meal in 75 seconds. “In 8 seconds a half-grilled frozen steak is thawed, in two more minutes it is ready to serve”. FALSE and TRUE – I think food was likely dominated by frozen food for a few decades, however there has been a movement back towards real food. Unfortunately “electric stoves” in the form of microwave ovens do cook food, although not in the times given!

Sawdust and woodpulp and converted into sugary foods. TRUE – Although not known by a lot of people the cellulose in wood pulp is used to stop pre-packaged shredded cheese from clumping, keeps low-fat ice cream creamy, and pre-made milk-shakes smooth.

The television set is connected with the telephones and the radio receiver. People can “see” each other through the televisions, “shopping by television”. TRUE – Yep, people can shop via TV, although people can’t see each other through TVs, they can through computers – practically the same thing.

Every operation in factories will be electronically, and automatically controlled. TRUE – mostly anyways. We still need people in factories doing tasks machines can’t and making sure the machines function properly.

A system to predict the weather from hour to hour – combination forecaster and calculating machine. “storms are more or less under control”.

It is easy enough to spot a budding hurricane in the doldrums off the coast of Africa. Before it has a chance to gather much strength and speed as it travels westward toward Florida, oil is spread over the sea and ignited. There is an updraft. Air from the surrounding region, which includes the developing hurricane, rushes in to fill the void. The rising air condenses so that some of the water in the whirling mass falls as rain.”  FALSE – We can’t properly predict weather (well, *maybe* 1-2 hours ahead), and certainly can’t control it.

Supersonic planes cover 1000 miles an hour, crossing the Atlantic in 3 hours. 1000-mile-an-hour rocket planes between Chicago and Paris. TRUE and FALSE – The Concorde flew New York to London in an average of 3.5 hours, however there aren’t any rocket planes (not yet at least), and the Concorde isn’t flying anymore.

People have family helicopters, kept on the roof. Cars are used for journeys less than 20 miles. FALSE – personal helicopters? Not anytime soon thank heavens. Cars still rule.

Commuters go to the city in huge aerial buses that hold 200 passengers. FALSE – It will never happen.

Messages are transmitted by phototelegraphy. TRUE – Faxes did exist, but have been largely superseded by electronic media.

Life span has been lengthened to 85. TRUE – The life span of humans may be about 120 now, but more realistic is the life expectancy, which is an average of 67 worldwide, and 82.2 in Canada

 

 

The butterfly effect

The outages Delta and Southwest airlines experienced with their computer systems are endemic of a larger problem – technology. We are now so reliant on technology, that a small glitch can lead to global backups. It may not actually be the glitch that is the problem, but the follow-on effects. This manifested itself a decade earlier in the Northeast Blackout of 2003, where 55 million people were without power for between 1-3 days. Glitches can also be caused by physical effects, such as storms, and volcanos. Case in point, the eruption of the Icelandic volcano Eyjafjallajökull in 2010. The resulting ash cloud disrupted air travel in northwest Europe for six days – 95,000 cancelled flights. Cancelled flights means that other industries suffer, for example companies like BMW suspending operations in German plants due to the interruption in the supply of parts. Also spoilage concerns as air freight of pharmaceutical and fruit/vegetables is also affected.

Ultimately we may be too reliant on technology.