An Introduction to Computer Science for Everyone
Total Page:16
File Type:pdf, Size:1020Kb
CS 101: An Introduction to Computer Science for Everyone Software Engineering and Programming Languages Fall 2015 Contents 1 Languages, Levels, Libraries, and Longevity 2 2 Lyft Goes Swift: How (And Why) It Rewrote Its App From Scratch in Apple's New Language 9 3 Programming Language Can Build Synthetic DNA 14 4 Coverty Gets Code Right 25% Faster 16 5 HTML5 vs Native: The Mobile App Debate 19 6 New mathematical framework formalizes oddball programming techniques 28 1 1 LANGUAGES, LEVELS, LIBRARIES, AND LONGEVITY 2 New programming languages are born every day. Why do some succeed and some fail? JOHN R. MASHEY, TECHVISER 32 December/January 2004-2005 rants: [email protected] more queue: www.acmqueue.com December/January 2004-2005 33 QUEUE QUEUE John Mashey, \Languages, Levels, Libraries, and Longevity." ACMqueue, December 2004. Copyright Association for Computing Machinery. Article provided by Library Reserves for private study, scholarship, or research. Do not redistribute. This article can also be found at http://queue.acm.org/detail.cfm?id=1039532. 1 LANGUAGES, LEVELS, LIBRARIES, AND LONGEVITY 3 Programming FOCUS Languages Languages, Levels, Libraries, and Longevity In 50 years, we’ve already seen numerous programming systems come and (mostly) go, although some have remained a long time and will probably do so for: decades? centuries? millennia? The questions about language designs, levels of abstraction, libraries, and resulting longevity are numerous. Why do new languages arise? Why is it sometimes easier to write new software than to adapt old software that works? How many different levels of languages make sense? Why do some languages last in the face of “better” ones? We can gather insights from the last 50 years of programming systems to the current time. For the far future, Vernor Vinge’s fine science-fiction novel, A Deepness in the Sky, rings all too true. The young protagonist, Pham, has joined a starship crew and is 32 December/January 2004-2005 rants: [email protected] more queue: www.acmqueue.com December/January 2004-2005 33 QUEUE QUEUE John Mashey, \Languages, Levels, Libraries, and Longevity." ACMqueue, December 2004. Copyright Association for Computing Machinery. Article provided by Library Reserves for private study, scholarship, or research. Do not redistribute. This article can also be found at http://queue.acm.org/detail.cfm?id=1039532. 1 LANGUAGES, LEVELS, LIBRARIES, AND LONGEVITY 4 Programming FOCUS Languages Languages, Levels, Libraries, and Longevity learning the high-value vocation of “programmer archae- powerful, barely visible descendants, containing layers of ologist,” as the crew’s safety depends on the ability to software (and more than a few trapdoors). In the United find needed code, use it, and modify it without breaking States, we already have approximately 100 CPUs per per- something. He is initially appalled at the code he finds: son, and this number has traditionally increased tenfold The programs were crap…Programming went back each decade. As wireless sensor networks proliferate, we to the beginning of time…There were programs face a future in which most objects have CPUs and are here that had been written five thousand years ago, linked together via radio. before Humankind ever left Earth. The wonder of Software already matters, will continue to matter even it—the horror of it…these programs still worked… more pervasively, and language choice will always be an down at the very bottom of it was a little program important element of software quality, understandability, that ran a counter. Second by second, the Qeng Ho and usability. counted from the instant that a human had first set foot on Old Earth’s moon. But if you looked at it still more closely… the starting instant was actually Language wars seem to go on forever. Classic refer- about fifteen million seconds later, the 0-second ences on early languages are Jean Sammet’s Programming of one of Humankind’s first computer operating Languages—HistoryLANGUAGE WARS and ARE Fundamentals FOREVER ,2 which discussed systems… approximately 120 important languages as of 1969, and “We should rewrite it all,” said Pham. Richard Wexelblat’s History of Progarmming Languages,3 “It’s been done,” said Sura. which recorded a conference that chose 10 important “It’s been tried,” corrected Bret…“You and a languages created before 1967 and still in use in 1977. thousand friends would have to work for a century Of the 10, substantial new code is still written by many or so to reproduce it… And guess what—even if you people in Basic, Cobol, and Fortran. Others remain popu- did, by the time you finished, you’d have your own lar in their specific domains (Lisp, APT, and occasionally set of inconsistencies. And you still wouldn’t be Snobol), and some long-established IBM languages (PL/I, consistent with all the applications that might be GPSS) remain. Most of the 120 are gone. needed now and then…” Successful languages continue to arise from small “The word for all this is ‘mature programming groups in industry or universities, from commercial environment.’”1 vendors, or via consortia. In fact, with current CPUs and Any old Unix person would be amused to think that software, it is easier for individuals to create interest- Unix’s January 1, 1970, date would be enshrined so long. ing languages. By 2020, when those CPUs are laughably We have begun a process in which many people’s lives ancient, it should become even easier. are already dependent on the correct working of software, Several Web sites extensively catalog computer lan- and likely to become even more so. Software once runna- guages, including http://hopl.murdoch.edu.au. ble only on large systems migrates downward onto larger numbers of smaller computers. Some current cellphones use 300-MHz CPUs, running at a rate higher than any Unlike computers, human beings are not easily reengi- CPU commercially produced by 1990. Some have 64 MB neered for higher performance. Programmers vary wildly of memory, competitive with many expensive systems inLEVELS ability, AND but LEVERAGEeach person has real I/O limits in reading of the late 1980s. Vinge’s book extrapolates from current and writing code. Much software progress has come from small “smart dust” computers to assume that 5,000 years using faster computers, more efficient for people, if less so from now, most computing will be done by their hyper- for the computer. Dramatic increases in computer perfor- 34 December/January 2004-2005 rants: [email protected] more queue: www.acmqueue.com December/January 2004-2005 35 QUEUE QUEUE John Mashey, \Languages, Levels, Libraries, and Longevity." ACMqueue, December 2004. Copyright Association for Computing Machinery. Article provided by Library Reserves for private study, scholarship, or research. Do not redistribute. This article can also be found at http://queue.acm.org/detail.cfm?id=1039532. 1 LANGUAGES, LEVELS, LIBRARIES, AND LONGEVITY 5 mance and storage are matched by the expansion of code. PHP, Javascript, and Python are widely used where code In each computer class (mainframe, minicomputer, need not be so efficient, but where human efficiency, ease microcomputer), people tended first to write assembly of expression, and maintenance are the highest priorities. code for performance, then use higher-level languages as Sometimes a change in computing environment requires the computer class became more powerful. Commonly, new types of languages to allow widespread use. Program- more powerful languages are later-binding, moving more ming distributed applications was for decades a difficult decisions closer to execution time. A typical progression task that could be handled only by experts, despite is as follows: repeated attempts to write better languages or toolkits for Assembly language is normally one-to-one with CPU creating them. The Web changed that substantially. instructions. As an example of the evolution of different levels of Macro-assembler is one-to-many with CPU instruc- languages, let’s go to the Bell Laboratories of the 1970s, tions, good for parameterized expansion of standard code one of several environments that helped create important sequences. Humans are still burdened with substantial foundations of current computing. Of course, its roots go work in arranging data storage, allocating registers, and even further back. choosing efficient instruction sequences. These first In 1970, “real computers” were still mainframes, two levels have mostly (and thankfully) disappeared for although minicomputers were seeing increasing use. The most programmers, but some small embedded micros DEC (Digital Equipment Corporation) 16-bit PDP-11 was and many DSPs (digital signal processors) are still pro- introduced in 1970, and of particular importance, the grammed this way. PDP-11/45 appeared in 1972, with up to 248 KB of MOS Higher-level algorithmic languages such as Fortran (metal-oxide semiconductor) memory. By 1975, the PDP- and C automate much low-level detail so the human can 11/70 allowed a huge increase to 4 MB, although each concentrate on algorithms. Object orientation, inspired program was still restricted to 64 KB instructions and 64 by Simula and Smalltalk, and found widely in C++, Java, KB data. Some sites supported 16 simultaneous users on and C#, improves code and eases maintenance with bet- an 11/45, and with heroic effort, 48 on an 11/70. The ter data structures. VAX-11/780 was introduced in 1977 Domain-specific languages such and spread lower-cost 32-bit comput- as APT (Automatically Programmed ing more widely. By the end of the Tools) aim at a target domain, and decade, minicomputers were “real so can supply specific operations computers,” and 32-bit microcom- needed there and ignore everything puters were beginning to appear. else. Text-processing languages, such In 1970, there was widespread as roff, troff, SGML, Scribe, TeX, Post- use of applications languages such as script, and HTML, are familiar mem- Fortran, Cobol, and PL/I, but many bers of this group, some of which are applications’ and most systems’ powerful programming languages in codes were still written in assem- their own right.