{"id":570,"date":"2012-02-19T18:15:35","date_gmt":"2012-02-19T18:15:35","guid":{"rendered":"http:\/\/blogs.kent.ac.uk\/mik\/?p=570"},"modified":"2020-05-15T15:46:57","modified_gmt":"2020-05-15T15:46:57","slug":"joc-17","status":"publish","type":"post","link":"https:\/\/blogs.kcl.ac.uk\/proged\/2012\/02\/19\/joc-17\/","title":{"rendered":"JoC #17: Bouncy coloured balls"},"content":{"rendered":"<p><em>\u00a0 \u00a0 \u00a0 Debugging is twice as hard as writing the code in the first place.<\/em><br \/>\n<em>\u00a0 \u00a0 \u00a0 Therefore, if you write the code as cleverly as possible, you are, <\/em><br \/>\n<em>\u00a0 \u00a0 \u00a0 by definition, not smart enough to debug it.<\/em><br \/>\n<em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u2014 Brian W. Kernighan.<\/em><\/p>\n<p>We&#8217;re leaving the &#8216;Trick, the turtle&#8217; scenario this week to make something new completely from scratch.<\/p>\n<p>The main purpose here is to piece together everything we have seen to far about the structure of a class, and create a complete new class (with fields, constructors and methods).<\/p>\n<p>Yes, I know, this doesn&#8217;t sound too exciting. I can see from the video view numbers that videos dealing with review of concepts aren&#8217;t quite as popular as the ones showing new stuff.<\/p>\n<p>So: Don&#8217;t worry. I&#8217;ve thrown a few interesting new things in as well: dynamically changing images, string concatenation and multiple constructors are some of them. Oh yes, and a first run-in with a runtime exception!<\/p>\n<p><iframe loading=\"lazy\" title=\"The Joy of Code #17: Bouncy coloured balls\" width=\"584\" height=\"329\" src=\"https:\/\/www.youtube.com\/embed\/brBjVL4Mx2Q?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p style=\"text-align: right\"><a href=\"http:\/\/www.greenfoot.org\/static\/joc\/mov\/JOC-17.mov\">Download video<\/a><\/p>\n<p><strong>Concepts discussed<\/strong>:\u00a0<em>class structure, field, constructor<\/em><em>, method, default constructor, changing images<\/em><\/p>\n<div><em><br \/>\n<\/em><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 \u00a0 Debugging is twice as hard as writing the code in the first place. \u00a0 \u00a0 \u00a0 Therefore, if you write the code as cleverly as possible, you are, \u00a0 \u00a0 \u00a0 by definition, not smart enough to &hellip; <a href=\"https:\/\/blogs.kcl.ac.uk\/proged\/2012\/02\/19\/joc-17\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":179,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,6],"tags":[30,38,46,49,70],"class_list":["post-570","post","type-post","status-publish","format-standard","hentry","category-greenfoot-software-tools","category-joy-of-code","tag-class","tag-constructor","tag-error","tag-field","tag-method"],"_links":{"self":[{"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/posts\/570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/users\/179"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/comments?post=570"}],"version-history":[{"count":1,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/posts\/570\/revisions"}],"predecessor-version":[{"id":1097,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/posts\/570\/revisions\/1097"}],"wp:attachment":[{"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/media?parent=570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/categories?post=570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.kcl.ac.uk\/proged\/wp-json\/wp\/v2\/tags?post=570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}