ebook img

A Machine Made This Book: Ten Sketches Of Computer Science PDF

200 Pages·2016·10.688 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview A Machine Made This Book: Ten Sketches Of Computer Science

A MACHINE MADE THIS BOOK tensketchesofcomputerscience Howdowedecidewheretoputinkonapagetodrawlettersand pictures? Howcancomputersrepresentalltheworld’slanguages andwritingsystems? Whatexactlyisacomputerprogram,what and how does it calculate, and how can we build one? Can we compress information to make it easier to store and quicker to transmit? Howdonewspapersprintphotographswithgreytones usingjustblackinkandwhitepaper? Howareparagraphslaidout automaticallyonapageandsplitacrossmultiplepages? InAMachineMadethisBook,usingexamplesfromthepublish- ingindustry,JohnWhitingtonintroducesthefascinatingdiscipline ofComputerSciencetotheuninitiated. JOHNWHITINGTONfoundedacompanywhichbuildssoftwarefor electronicdocumentprocessing. Hestudied,andtaught,Computer ScienceatQueens’College,Cambridge. Hehaswrittentextbooks before, but this is his first attempt at something for the popular audience. A M M ACHINE ADE THIS B OOK ten sketches of computer science JohnWhitington COHERENT PRESS COHERENT PRESS Cambridge PublishedintheUnitedKingdombyCoherentPress,Cambridge ©CoherentPress2016 Thispublicationisincopyright.Subjecttostatutory exceptionnoreproductionofanypartmaytakeplace withoutthewrittenpermissionofCoherentPress. FirstpublishedMarch2016 AcataloguerecordforthisbookisavailablefromtheBritishLibrary ISBN978-0-9576711-2-6Paperback bythesameauthor PDFExplained(O’Reilly,2012) OCamlfromtheVeryBeginning(Coherent,2013) MoreOCaml:Algorithms,Methods&Diversions(Coherent,2014) Contents Preface v 1 PuttingMarksonPaper 1 2 LetterForms 15 3 StoringWords 27 4 LookingandFinding 41 5 TypingitIn 53 6 SavingSpace 65 7 DoingSums 81 8 GreyAreas 97 9 OurTypeface 123 10 WordstoParagraphs 135 Solutions 147 FurtherReading 169 Templates 173 Colophon 181 Index 183 v Preface Itcanbetremendouslydifficultforanoutsidertounderstandwhy computerscientistsareinterestedinComputerScience. Itiseasyto seethesenseofwonderoftheastrophysicist,oroftheevolutionary biologistorzoologist. Wedon’tknowtoomuchaboutthemathe- matician,butweareinaweanyway. ButComputerScience? Well, we suppose it must have to do with computers, at least. “Com- puterscienceisnomoreaboutcomputersthanastronomyisabout telescopes”, the great Dutch computer scientist Edsger Dijkstra (1930–2002),wrote. Thatistosay,thecomputerisourtoolforex- ploringthissubjectandforbuildingthingsinitsworld,butitisnot theworlditself. Thisbookmakesnoattemptatcompletenesswhatever. Itis,as thesubtitlesuggests,asetoflittlesketchesoftheuseofcomputer sciencetoaddresstheproblemsofbookproduction. Bylooking fromdifferentanglesatinterestingchallengesandprettysolutions, wehopetogainsomeinsightintotheessenceofthething. Ihopethat,bytheend,youwillhavesomeunderstandingof why these things interest computer scientists and, perhaps, you willfindthatsomeoftheminterestyou. vii viii Chapter1 starts from nothing. We have a plain white page on whichtoplacemarksininktomakelettersandpictures.How do we decide where to put the ink? How can we draw a convincingstraightline? Usingamicroscope,wewilllookat theeffectofputtingthesemarksonrealpaperusingdifferent printingtechniques.Weseehowtheproblemanditssolutions changeifwearedrawingonthecomputerscreeninsteadof printingonpaper.Havingdrawnlines,webuildfilledshapes. Chapter2 shows how to draw letters from a realistic typeface – letterswhicharemadefromcurvesandnotjuststraightlines. We will see how typeface designers create such beautiful shapes,andhowwemightdrawthemonthepage. Alittle geometryisinvolved,butnothingwhichcan’tbedonewitha penandpaperandaruler. Wefilltheseshapestodrawletters onthepage,anddealwithsomesurprisingcomplications. Chapter3 describes how computers and communication equip- mentdealwithhumanlanguage, ratherthanjustthenum- berswhicharetheirnativetongue. Weseehowtheworld’s languagesmaybeencodedinastandardform,andhowwe cantellthecomputertodisplayourtextindifferentways. Chapter4 introducessomeactualcomputerprogramming,inthe contextofamethodforconductingasearchthroughanexist- ingtexttofindpertinentwords,aswemightwhenconstruct- inganindex. Wewritearealprogramtosearchforaword inagiventext,andlookatwaystomeasureandimproveits performance. Weseehowthesetechniquesareusedbythe searchenginesweuseeveryday. Chapter5 exploreshowtogetabookfulofinformationintothe computertobeginwith. Afterahistoricalinterludeconcern- ingtypewritersandsimilardevicesfromthenineteenthand earlytwentiethcenturies,weconsidermodernmethods.Then welookathowtheAsianlanguagescanbetyped,eventhose whichhavehundredsofthousandsormillionsofsymbols. Chapter6 deals with compression – that is, making words and images take up less space, without losing essential detail. Howeverfastandcapaciouscomputershavebecome,itisstill necessarytokeepthingsassmallaspossible. Asapractical example,weconsiderthemethodofcompressionusedwhen sendingfaxes. ix Chapter7 introduces more programming, of a slightly different kind. Webeginbyseeinghowcomputerprogramscalculate simplesums,followingthefamiliarschoolboyrules. Wethen buildmorecomplicatedthingsinvolvingtheprocessingof listsofitems. Bythenendofthechapter,wehavewrittena substantive,real,program. Chapter8 addresses the problem of reproducing colour or grey toneimagesusingjustblackinkonwhitepaper. Howcanwe dothisconvincinglyandautomatically? Welookathistori- calsolutionstothisproblemfrommedievaltimesonwards, and try out some different modern methods for ourselves, comparingtheresults. Chapter9 looksagainattypefaces. Weinvestigatetheprincipal typefaceusedinthisbook,Palatino,andsomeofitsintricacies. Webegintoseehowlettersarelaidoutnexttoeachotherto formalineofwordsonthepage. Chapter10 showshowtolayoutapagebydescribinghowlines oflettersarecombinedintoparagraphstobuildupablockof text. Welearnhowtosplitwordswithhyphensattheendof lineswithoutugliness,andwelookathowthissortoflayout wasdonebeforecomputers.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.