18

According to a recent Wired article, US President Barack Obama was the first president to write code:

President Barack Obama told the world that everyone should learn how to code. And now he’s putting his money where his mouth is.

Earlier today, to help kick-off the annual Computer Science Education Week, Obama became the first president ever to write a computer program. It was a very simple program—all it does is draw a square on a screen

[...]

Partovi says the president himself didn’t complete the tutorial from start to finish, but instead went from station to station watching the students work. He did, however, complete some of the exercises, which involved both using Google’s Blockly tool, and writing a line of code using the programming language JavaScript.

I'm wondering whether that is truth or not.

mati
  • 289
  • 2
  • 5
  • [Welcome to Skeptics!](http://meta.skeptics.stackexchange.com/questions/1505/welcome-to-new-users) I removed your side question "[is there] any other [politicians] involved or promoting computer programming worldwide?" because the claim is that he is the first US president to write a program, not the first politician anywhere. – Oddthinking Dec 09 '14 at 05:08
  • Related: [Clinton sent the first presidential email](http://www.buzzfeed.com/leonoraepstein/the-story-of-how-bill-clinton-sent-the-first-presidential-em). – Oddthinking Dec 09 '14 at 07:20
  • 7
    Define "computer program". There are languages in which any string is a valid program which outputs itself, which would make anything written "a computer program". What criteria would you like to use to determine what a computer program is? – rumtscho Dec 09 '14 at 11:12
  • 2
    If you're asking whether he definitively did it, the answer is yes: you can watch a video right [here](http://www.theverge.com/2014/12/9/7358111/barack-obama-coding). As for whether he was the first, it would be impossible to say for certain that no president ever wrote any code, but you can assume that. I think it would be news if a previous president had done something like this. So the answer is probably yes. – PointlessSpike Dec 09 '14 at 12:35
  • 6
    Is the question if he is the first President to do so _while_ President, or first President to ever do so? Would GW or Clinton possibly have done some while in school? – JasonR Dec 09 '14 at 14:48
  • 9
    @rumtscho I think a safe qualifier is something *intentionally* written to be run as a program. I don't think counting "everything ever written on a computer" is very useful here. – Is Begot Dec 09 '14 at 15:34
  • 2
    How is this notable? **Is there ANY evidence that anyone doubts the fact?** – user5341 Dec 10 '14 at 12:53
  • 9
    @DVK: That he coded something is reasonably indisputable. That he's the first... that's still unsettled. I personally find it a bit amazing that none of them would before, but I also know that I grew up in a different era, where it was a given that people learned at least BASIC and Logo in elementary school. I don't think my parents have ever programmed anything. – Sean Duggan Dec 10 '14 at 14:48
  • @SeanDuggan - there's a difference between "unsettled" and "there's a notable skepticism about this claim". Given when Bush and Clinton studied, it's not a reasonable assumption that they should have. – user5341 Dec 10 '14 at 19:05
  • 2
    @DVK: {nods} I suppose it just feels like one of those weird little trivia points like how they occasionally trot out the factoid that Millard Fillmore was the first president to have indoor plumbing (which, as best I understand, has been refuted repeatedly). But short of statements from the prior presidents that they never coded in their life, I don't suppose we'll get an answer. – Sean Duggan Dec 10 '14 at 19:55
  • Of course, you can also get into the question of what exactly entails "programming". How advanced a language? How complicated a program? Does it count if you're just typing things off of a sheet and hitting the compile button without understanding? Maybe a better answer is that it doesn't matter, but how often does that stop a trivia debate? :-P – Sean Duggan Dec 10 '14 at 19:57
  • [How much controversy must surround a claim?](http://meta.skeptics.stackexchange.com/q/2874/2703) doesn't have very strong / highly-upvoted answers, but it says that: a) topics don't necessarily need to be doubted to be on-topic, they only need to be believed to be on-topic; and b) the fact that a claim may be true is not sufficient reason for closing it. – ChrisW Dec 11 '14 at 00:54
  • I would think that it's really just a question of Clinton and George W Bush: Bush Sr was an executive by the late 50s and it doesn't seem likely Reagan or Carter (who left the Navy in 53) would have had cause. The premise that computer programming is a type of general literacy is quite new. – Larry OBrien Jul 08 '15 at 17:52
  • 1
    I'm pretty sure that Bill Clinton not only wrote computer programs, but in the language he secretly invented, namely Brainf*ck. – Michael May 20 '16 at 03:15

2 Answers2

3

According to White House sources, yes. Per the official White House blog, "President Obama became the first US president to write a line of code as part of the "Hour of Code", an online event to promote Computer Science Education Week". The US President Barack Obama wrote 'moveForward(100)' as his first line of code using the computer programming language JavaScript, which was the part of an online exercise on 8 December 2014.

The president wrote a single line of JavaScript in a tutorial based on Disney's film "Frozen," explained Hadi Partovi, the CEO of Code.org. The line, "moveForward(100);" moved main character Elsa 100 pixels to draw a square. President Barack Obama also did a "fist bump" with a student Adrianna Mitchell during the event in the Eisenhower Executive Office Building on the White House complex in Washington, Monday, Dec. 8, 2014, attended by middle-school students from Newark, N.J.

pericles316
  • 22,676
  • 2
  • 84
  • 161
  • 8
    I didn't find this very convincing; they didn't quote their sources. It is pretty much a repeat of the claim rather than an evidence-based answer. – Oddthinking Jul 08 '15 at 08:03
  • 3
    @Oddthinking: It is better than nothing. At least some authoritative source. – George Chalhoub Jul 08 '15 at 08:17
  • 1
    @Oddthinking: Adrianna Mitchell and 29 other middle-school students from Newark, New Jersey and Brooklyn, New York present during the coding event are the only evidence that can be produced for the President coding for the first time. – pericles316 Jul 08 '15 at 08:18
  • 1
    @Oddthinking The question runs into the difficulty of proving a negative. The blog demonstrates that, as far as the white house knows, no president has previously written programming code. – Taemyr Jul 08 '15 at 09:45
  • 3
    The answer also assumes the blog is factually correct. Given the volatile and partisan nature of many things in this administration, it may just be political propaganda to make Obama look good. – jwenting Jul 08 '15 at 10:41
  • I've weakened the point-blank "yes" with an "according to..." which seems to be more in line with the evidence provided. – Sklivvz Jul 08 '15 at 11:35
0

I think it depends how we define "write a program". He appears to have used a Code.Org tutorial that I often use with my students (I'm an elementary computer teacher.)

The president wrote a single line of JavaScript in a tutorial based on Disney's film "Frozen," explained Hadi Partovi, the CEO of Code.org. The line, "moveForward(100);" moved main character Elsa 100 pixels to draw a square. Source

This is the tutorial in question Source (same as above)

As you can see in the tutorial, you "write" code by dragging pieces and attaching them to the "program". You can see the code that you have "written" by clicking the "show code" button in the top right hand corner. There is no way to manually type in any code in this tutorial, it is purely dragging pieces (with behind-the-scenes code attached to them) to the correct spot.

So it is highly unlikely that the president typed in "moveForward(100);", or typed in anything for that matter, because there is nowhere to type anything in during that tutorial. What he probably did do, however, is place the correct piece in the correct spot (mind you at this level it is not very difficult as there are only two other pieces to choose from), and Code.Org created the code to execute his "program" for him behind the scenes.

Does that count as writing code? You tell me.

As for whether he was the first to do this or not, admittedly I have no idea. I'm not sure there is any way to prove that a previous president didn't "write" code short of asking all of the presidents who have lived since code was a thing.

Andrew Whatever
  • 469
  • 1
  • 3
  • 9
  • 3
    I encourage you to cite additional reputable sources to back up your answer. – HDE 226868 Jul 08 '15 at 18:57
  • According to everything I read they said he did type "moveForward(100);" However, typing Excel formulas is more like programming than that so the claim is dubious anyways. – Sam I Am Jul 08 '15 at 21:05
  • What did you read that explicitly says that he typed out that command? Code.Org uses language like "Write Your First Computer Program" but the tutorials are "block-based" aka drag and drop only. I haven't gone through literally every one to confirm this but the one linked in the article on Obama is definitely drag and drop only. You can see the code your dragging and dropping produces but you cannot type code directly. – Andrew Whatever Jul 08 '15 at 21:29
  • I don't have strong feelings on Obama one way or the other but it appears "write a computer program" means "drag the correct block out of the three choices provided to the other side of the screen" in this case. Whether you want to call that writing a computer program or not... that's debatable I suppose. I wouldn't myself, though the site is a great tool for teaching beginners the basic concepts behind coding. – Andrew Whatever Jul 08 '15 at 21:31
  • @AndrewHatsworth http://www.forbes.com/sites/quora/2014/12/10/what-program-did-obama-write-to-kick-off-hour-of-code-2014/ "The President asked if he needs to type the F in upper-case, and he got the () and the ; right too, he was very precise and didn’t make a typing mistake." That was from Hadi Partovi, the CEO of Code.org. – Sam I Am Jul 10 '15 at 03:47
  • Interesting. There seems to be a discrepancy here though. The tutorial linked in the Huff Post article does not allow for typing in code, unless I am wrong (feel free to check it out yourself and see.) Yet the CEO of Code.Org is claiming Obama typed his code. Possibly he did a different Frozen tutorial? I don't know of any Frozen tutorial on there that allows typing though, and even in the Forbes article they just link us to the "block-based" one again. I don't imagine the CEO is lying but where is this Frozen tutorial that you can type in and why is no one linking to it when reporting?! – Andrew Whatever Jul 10 '15 at 15:26