{"id":23687,"date":"2023-05-08T09:45:44","date_gmt":"2023-05-08T09:45:44","guid":{"rendered":"https:\/\/www.booksofall.com\/?post_type=product&#038;p=23687"},"modified":"2023-05-08T09:45:44","modified_gmt":"2023-05-08T09:45:44","slug":"how-to-design-programs-an-introduction-to-programming-and-computing","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/","title":{"rendered":"How to Design Programs &#8211; An Introduction to Programming and Computing"},"content":{"rendered":"<h2>Prologue: How To Program<\/h2>\n<p>When you were a small child, your parents taught you to count and perform simple calculations with your fingers: \u201c1 + 1 is 2\u201d; \u201c1 + 2 is 3\u201d; and so on. Then they would ask \u201cwhat\u2019s 3 + 2?\u201d and you would count off the fingers of one hand. They programmed, and you computed. And in some way, that\u2019s really all there is to <a href=\"https:\/\/en.wikipedia.org\/wiki\/Computer_programming\">programming<\/a> and computing.<\/p>\n<p>Now it is time to switch roles. Start <a href=\"https:\/\/racket-lang.org\/\">DrRacket<\/a>. Doing so brings up the window of figure 3. Select \u201cChoose language\u201d from the \u201cLanguage\u201d menu, which opens a dialog listing \u201cTeaching Languages\u201d for \u201cHow to Design Programs.\u201d Choose \u201cBeginning Student\u201d (the Beginning Student Language, or BSL) and click\u00a0<i>OK<\/i>\u00a0to set up DrRacket. With this task completed,\u00a0<b>you<\/b>\u00a0can program, and the DrRacket software becomes the child. Start with the simplest of all calculations. You type<\/p>\n<p>(+ 1 1)<\/p>\n<p>into the top part of DrRacket, click\u00a0<i>RUN<\/i>, and a 2 shows up in the bottom.<\/p>\n<p id=\"BsAXXHQ\"><img loading=\"lazy\" decoding=\"async\" width=\"469\" height=\"405\" class=\"alignnone size-full wp-image-23691 \" src=\"https:\/\/www.booksofall.com\/wp-content\/uploads\/2023\/05\/img_6458c2cc3e187.png\" alt=\"\" \/><\/p>\n<p>That\u2019s how simple programming is. You ask questions as if DrRacket were a child, and DrRacket computes for you. You can also ask DrRacket to process several requests at once:<\/p>\n<p>(+ 2 2)<br \/>\n(* 3 3)<br \/>\n(- 4 2)<br \/>\n(\/ 6 2)<\/p>\n<p>After you click\u00a0<i>RUN<\/i>, you see 4 9 2 3 in the bottom half of DrRacket, which are the expected results.<\/p>\n<p>Let\u2019s slow down for a moment and introduce some words:<\/p>\n<ul>\n<li>The top half of DrRacket is called the <i>definitions area<\/i>. In this area, you create the programs, which is called\u00a0<i>editing<\/i>. As soon as you add a word or change something in the definitions area, the\u00a0<i>SAVE<\/i>\u00a0button shows up in the top-left corner. When you click\u00a0<i>SAVE<\/i>\u00a0for the first time, DrRacket asks you for the name of a file so that it can store your program for good. Once your definitions area is associated with a file, clicking\u00a0<i>SAVE<\/i>\u00a0ensures that the content of the definitions area is stored safely in the file.<\/li>\n<li><i>Programs<\/i>\u00a0consist of\u00a0<i>expressions<\/i>. You have seen expressions in mathematics. For now, an expression is either a plain number or something that starts with a left parenthesis \u201c(\u201d and ends in a matching right parenthesis \u201c)\u201d\u2014which DrRacket rewards by shading the area between the pair of parentheses.<\/li>\n<li>When you click <i>RUN<\/i>, DrRacket evaluates the expressions in the definitions area and shows their result in the\u00a0<i>interactions area<\/i>. Then, DrRacket, your faithful servant, awaits your commands at the\u00a0<i>prompt<\/i>\u00a0(&gt;). The appearance of the prompt signals that DrRacket is waiting for you to enter additional expressions, which it then evaluates like those in the definitions area:<br \/>\n&gt; (+ 1 1)<br \/>\n2<\/li>\n<\/ul>\n<p>Enter an expression at the prompt, hit the \u201creturn\u201d or \u201center\u201d key on your keyboard, and watch how DrRacket responds with the result. You can do so as often as you wish:<br \/>\n&gt; (+ 2 2)<br \/>\n4<br \/>\n&gt; (* 3 3)<br \/>\n9<br \/>\n&gt; (- 4 2)<br \/>\n2<br \/>\n&gt; (\/ 6 2)<br \/>\n3<br \/>\n&gt; (sqr 3)<br \/>\n9<br \/>\n&gt; (expt 2 3)<br \/>\n8<br \/>\n&gt; (sin 0)<br \/>\n0<br \/>\n&gt; (cos pi)<br \/>\n#i-1.0<\/p>\n<p>Take a close look at the last number. Its \u201c#i\u201d prefix is short for \u201cI don\u2019t really know the precise number so take that for now\u201d or an\u00a0<i>inexact number<\/i>. Unlike your calculator or other programming systems, DrRacket is honest. When it doesn\u2019t know the exact number, it warns you with this special prefix. Later, we will show you really strange facts about \u201ccomputer numbers,\u201d and you will then truly appreciate that DrRacket issues such warnings.<\/p>\n<p>By now you might be wondering whether DrRacket can add more than two numbers at once, and yes, it can! As a matter of fact, it can do it in two different ways:<br \/>\n&gt; (+ 2 (+ 3 4))<br \/>\n9<br \/>\n&gt; (+ 2 3 4)<br \/>\n9<\/p>\n<p>The first one is\u00a0<i>nested arithmetic<\/i>, as you know it from school. The second one is\u00a0<i>BSL arithmetic<\/i>; and the latter is natural, because in this notation you always use parentheses to group operations and numbers together.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 750px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/how-to-design-programs-an-introduction-to-programming-and-computing-2nd-edition-1cg6cqw2ec?p=1\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":23692,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"When we start programming, we need to understand that It is not just about knowing programming, but also about mastering it. Learn more from this book!"},"product_brand":[],"product_cat":[384],"product_tag":[],"class_list":{"0":"post-23687","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-software-architecture","8":"first","9":"instock","10":"shipping-taxable","11":"product-type-simple"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Design Programs - An Introduction to Programming and Computing - BooksOfAll Portuguese<\/title>\n<meta name=\"description\" content=\"When we start programming, we need to understand that It is not just about knowing programming, but also about mastering it. Learn more from this book!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Design Programs - An Introduction to Programming and Computing - BooksOfAll Portuguese\" \/>\n<meta property=\"og:description\" content=\"When we start programming, we need to understand that It is not just about knowing programming, but also about mastering it. Learn more from this book!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Portuguese\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg\" \/><meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"827\" \/>\n\t<meta property=\"og:image:height\" content=\"1169\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Tempo estimado de leitura\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/\",\"url\":\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/\",\"name\":\"How to Design Programs - An Introduction to Programming and Computing - BooksOfAll Portuguese\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/pt\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg\",\"datePublished\":\"2023-05-08T09:45:44+00:00\",\"description\":\"When we start programming, we need to understand that It is not just about knowing programming, but also about mastering it. Learn more from this book!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg\",\"contentUrl\":\"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg\",\"width\":\"827\",\"height\":\"1169\",\"caption\":\"How to Design Programs - An Introduction to Programming and Computing\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/pt\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/pt\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Design Programs &#8211; An Introduction to Programming and Computing\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/pt\/#website\",\"url\":\"https:\/\/www.booksofall.com\/pt\/\",\"name\":\"BooksOfAll Portuguese\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/pt\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/pt\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-PT\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/pt\/#organization\",\"name\":\"BooksOfAll Portuguese\",\"url\":\"https:\/\/www.booksofall.com\/pt\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\/\/www.booksofall.com\/pt\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Portuguese\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/pt\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Design Programs - An Introduction to Programming and Computing - BooksOfAll Portuguese","description":"When we start programming, we need to understand that It is not just about knowing programming, but also about mastering it. Learn more from this book!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/","og_locale":"pt_PT","og_type":"article","og_title":"How to Design Programs - An Introduction to Programming and Computing - BooksOfAll Portuguese","og_description":"When we start programming, we need to understand that It is not just about knowing programming, but also about mastering it. Learn more from this book!","og_url":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/","og_site_name":"BooksOfAll Portuguese","og_image":[{"url":"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg","type":"","width":"","height":""},{"width":827,"height":1169,"url":"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg","twitter_misc":{"Tempo estimado de leitura":"3 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/","url":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/","name":"How to Design Programs - An Introduction to Programming and Computing - BooksOfAll Portuguese","isPartOf":{"@id":"https:\/\/www.booksofall.com\/pt\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg","datePublished":"2023-05-08T09:45:44+00:00","description":"When we start programming, we need to understand that It is not just about knowing programming, but also about mastering it. Learn more from this book!","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/"]}]},{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#primaryimage","url":"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg","contentUrl":"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2023\/05\/How-to-Design-Programs-An-Introduction-to-Programming-and-Computing.jpg","width":"827","height":"1169","caption":"How to Design Programs - An Introduction to Programming and Computing"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/pt\/how-to-design-programs-an-introduction-to-programming-and-computing\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/pt\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/pt\/categories\/"},{"@type":"ListItem","position":3,"name":"How to Design Programs &#8211; An Introduction to Programming and Computing"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/pt\/#website","url":"https:\/\/www.booksofall.com\/pt\/","name":"BooksOfAll Portuguese","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/pt\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/pt\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-PT"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/pt\/#organization","name":"BooksOfAll Portuguese","url":"https:\/\/www.booksofall.com\/pt\/","logo":{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/www.booksofall.com\/pt\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/pt\/wp-content\/uploads\/sites\/8\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Portuguese"},"image":{"@id":"https:\/\/www.booksofall.com\/pt\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/pt\/wp-json\/wp\/v2\/product\/23687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/pt\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/pt\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/pt\/wp-json\/wp\/v2\/media\/23692"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/pt\/wp-json\/wp\/v2\/media?parent=23687"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/pt\/wp-json\/wp\/v2\/product_brand?post=23687"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/pt\/wp-json\/wp\/v2\/product_cat?post=23687"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/pt\/wp-json\/wp\/v2\/product_tag?post=23687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}