{"id":6395,"date":"2014-11-14T18:57:55","date_gmt":"2014-11-14T18:57:55","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=6395"},"modified":"2014-11-14T18:57:55","modified_gmt":"2014-11-14T18:57:55","slug":"programming-subroutines","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/programming-subroutines\/","title":{"rendered":"Programming:  subroutines"},"content":{"rendered":"<h1>Tutoring computer science, you deal with constructs that are both ideas and real-life segments of code. \u00a0The tutor brings forth the idea of subroutines.<\/h1>\n<p>In old-style programming (ie, during the 70s and 80s), the concept of a subroutine was crucial. \u00a0Other names for it were &#8220;procedure&#8221; or &#8220;function&#8221;. \u00a0The subroutine was a self-contained mini-program that was called, did a job for the main program, then was left alone again. \u00a0It could be called repeatedly. \u00a0A typical program you might write for an assignment could have numerous subroutines; a large program might easily have dozens or more.<\/p>\n<p>As I recall, before the days of object-oriented programming, subroutines were the focus. Students were taught to think and program in terms of subroutines:  the main task was meant to be divided into smaller, separate ones, for each of which a subroutine could be written.  Not only could each subroutine be written independently; it could also be tested independently. \u00a0Finding a bug is much easier in a subroutine than in a larger program. \u00a0Moreover, it is easier for another person, who didn&#8217;t write the program, to understand how it works when the program&#8217;s functionality is divided among subroutines. Each subroutine would, of course, be appropriately commented (see my post <a href=\"?p=5754\">here<\/a>), so that the reader would easily know its purpose.<\/p>\n<p>The approach to programming that centers around subroutines is called <em>procedural<\/em>.  You&#8217;ll hear it called the <em>procedural paradigm<\/em>.  While it&#8217;s probably been eclipsed by object oriented programming (the <em>object oriented paradigm<\/em>), it&#8217;s still preferred in some circles.<\/p>\n<p>I&#8217;ll be further discussing underlying approaches to programming &#8211; for instance, the object oriented approach &#8211; in future posts.  Cheers:)<\/p>\n<p><em>Source<\/em>: <a href=\"http:\/\/en.wikipedia.org\/wiki\/Programming_paradigm\">Wikipedia<\/a><br \/>\nJack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tutoring computer science, you deal with constructs that are both ideas and real-life segments of code. \u00a0The tutor brings forth the idea of subroutines. In old-style programming (ie, during the 70s and 80s), the concept of a subroutine was crucial. &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/programming-subroutines\/\"> <span class=\"screen-reader-text\">Programming:  subroutines<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[287,290,289,288,291],"class_list":["post-6395","post","type-post","status-publish","format-standard","hentry","category-computer-science","tag-approaches-to-programming","tag-procedural-paradigm","tag-procedural-programming","tag-programming-paradigm","tag-subroutines"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/6395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=6395"}],"version-history":[{"count":22,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/6395\/revisions"}],"predecessor-version":[{"id":6417,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/6395\/revisions\/6417"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=6395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=6395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=6395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}