{"id":1218,"date":"2019-01-14T00:00:00","date_gmt":"2019-01-13T12:00:00","guid":{"rendered":"https:\/\/jonesnz.com\/index.php\/2019\/01\/14\/moodle-development-getting-started\/"},"modified":"2019-01-14T00:00:00","modified_gmt":"2019-01-13T12:00:00","slug":"moodle-development-getting-started","status":"publish","type":"post","link":"https:\/\/jonesnz.com\/index.php\/2019\/01\/14\/moodle-development-getting-started\/","title":{"rendered":"Moodle Development: getting started."},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Introduction<\/h4>\n\n\n\n<p><strong>NOTE:<\/strong> This post first appeared in eLearning World last year: <a href=\"https:\/\/www.elearningworld.org\/\">https:\/\/www.elearningworld.org\/<\/a>. Since then Simple Lesson has been published in the Moodle Plugins database: <br><a href=\"https:\/\/moodle.org\/plugins\/mod_simplelesson\">Moodle plugins directory: Simple lesson<\/a><\/p>\n\n\n\n<p>Moodle Bites for Developers Level 1 starts February 1st 2019.<\/p>\n\n\n\n<p>As a user, teacher and lecturer of programming languages from FORTRAN IV to Java I\u2019ve long been interested in the topic of Moodle programming, but every time I have started I\u2019ve hit some kind of wall:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Lack of (or outdated) documentation<\/li><li>Lack of detailed PHP knowledge<\/li><li>Lack of help and support<\/li><li>Difficulty in understanding the source code<\/li><\/ul>\n\n\n\n<p>Then in frustration I\u2019ve given up.<\/p>\n\n\n\n<p>This last year I published my first Moodle plugin to the\ndatabase and I\u2019m deep into my second.&nbsp;\nI\u2019m still not a fully-fledged developer but I do understand a lot more\nthan before.&nbsp; So much so that I\u2019m helping\nto facilitate a MoodleBites course in the subject<a href=\"#_ftn1\">[1]<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Motivation<\/h4>\n\n\n\n<p>One of the things needed to bring about this change was\nmotivation.&nbsp; I\u2019d been working with people\nwho were developing Moodle courses making extensive use of the Lesson Activity\nin Moodle.&nbsp; It\u2019s not a bad activity but\nit does suffer one serious shortcoming \u2013 you cannot use questions from the\nquestion bank in a lesson.<\/p>\n\n\n\n<p>I began to Google around and pretty soon discovered that\nthis had occurred to people before and they had not been able to solve it yet,\nmostly through lack of time.&nbsp; Being in my\nlate 60\u2019s time is not as much of a luxury as it used to be for me.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Guidance<\/h4>\n\n\n\n<p>Stuart at HRDNZ knew that I was interested and offered me a\nplace on Justin Hunt\u2019s MoodleBites for Developers Level 1 course.&nbsp;&nbsp; Justin is \u201cthe POODLL guy\u201d \u2013 the smart\nMoodle Developer of that Swiss-army knife of Moodle improvements, especially\ngood for language learning<a href=\"#_ftn2\">[2]<\/a>.<\/p>\n\n\n\n<p>Although the course covers much of the basics of Moodle\nprogramming (by no means all) it also teaches the value of persistence \u2013 or\nshould I say without persistence you will find it hard to complete.&nbsp; This is not the nature of the course material\nor the skill of the facilitator, rather it is the nature of the challenge.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Persistence<\/h4>\n\n\n\n<p>Persistence for me was, when faced with a challenge, not\ngoing first to the forums and getting the answer but working back and finding\nout where I had strayed from the path.&nbsp;\nExperienced Moodle Developers have all sorts of tools at their\ndisposal.&nbsp; All I had was echo and\nvar_dump.&nbsp; Echo allows you to print\nthings at your console (you can also log messages to your error log). Var_dump\nallows you to see the \u201cguts\u201d of an object and work out what you should be doing\nwith it.<\/p>\n\n\n\n<p>Armed with these simple tools I would go back over my code\nand figure it out for myself, resulting in those wonderful \u201cah hah\u201d\nmoments.&nbsp; When you have those, by the\nway, don\u2019t forget top put them in your Evernote or whatever you use for a log.<\/p>\n\n\n\n<p>I\u2019ve sometimes puzzled for days over some piece of code and\nthis has led to a broader and deeper understanding of Moodle structure and\ncoding norms.&nbsp; Even some of the\ndocumentation at Moodle org started to make sense.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Support<\/h4>\n\n\n\n<p>There is, of course, an endless amount of knowledge already\non the internet about Moodle, PHP, JavaScript and other technologies.&nbsp; So much in fact that you sometimes have to be\npretty skilled to find the missing piece you are looking for.<\/p>\n\n\n\n<p>Obvious sites are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The Moodle General Developer forum<a href=\"#_ftn3\">[3]<\/a><\/li><li>Stack Overflow<a href=\"#_ftn4\">[4]<\/a><\/li><li>The Developer documentation<a href=\"#_ftn5\">[5]<\/a><\/li><\/ul>\n\n\n\n<p>Less obvious routes include looking at GitHub for Moodle HQ\nand other developer\u2019s accounts and studying the code of any plugin somewhat\nsimilar to the one you are trying to build.&nbsp;\n<\/p>\n\n\n\n<p>The Moodle database will also help you understand what\nvariables\/properties belong to which classes\/objects and gain a deeper\nunderstanding of what your code is actually producing.&nbsp; I have found this especially useful when\ntrying to understand how my plugins store media files.<\/p>\n\n\n\n<p>For a really quick but excellent overview of Moodle architecture,\nyou can read Tim Hunt\u2019s excellent guide<a href=\"#_ftn6\">[6]<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Action<\/h4>\n\n\n\n<p>As many people will tell you, learning by doing Moodle\ndevelopment is better and more effective than learning by reading about Moodle\nDevelopment.&nbsp; In fact Moodle is built on\nthe philosophy of social constructionism<a href=\"#_ftn7\">[7]<\/a>.\n<\/p>\n\n\n\n<p>If you see an error message as an example of feedback on\nyour learning, a challenge to be googled, rather than as an obstacle to your\nprogress you will learn more effectively.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Pre-requisites<\/h4>\n\n\n\n<p>We\u2019ve already mentioned personal traits such as persistence\nto which we can add optimism and a sense of humour.&nbsp; However, you will also need:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A sound knowledge of programming (preferably in\nPHP, preferably Object Orientated)<\/li><li>A good understanding of SQL and relational\ndatabases<\/li><li>A good understanding of html and css.<\/li><li>An understanding of JavaScript.<\/li><\/ul>\n\n\n\n<p>It\u2019s true that if you are not familiar with all of the above\ntechnologies you can learn as you go.&nbsp; A\ngood source of basic knowledge is at the W3Schools website<a href=\"#_ftn8\">[8]<\/a>\nwhich may help if you have some gaps.<\/p>\n\n\n\n<p>Good luck!<br><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a href=\"#_ftnref1\">[1]<\/a> <a href=\"https:\/\/www.moodlebites.com\/mod\/page\/view.php?id=24546\">https:\/\/www.moodlebites.com\/mod\/page\/view.php?id=24546<\/a><\/p>\n\n\n\n<p><a href=\"#_ftnref2\">[2]<\/a> https:\/\/poodll.com\/<\/p>\n\n\n\n<p><a href=\"#_ftnref3\">[3]<\/a> <a href=\"https:\/\/moodle.org\/mod\/forum\/view.php?f=33\">https:\/\/moodle.org\/mod\/forum\/view.php?f=33<\/a><\/p>\n\n\n\n<p><a href=\"#_ftnref4\">[4]<\/a> <a href=\"https:\/\/stackoverflow.com\/questions\/tagged\/moodle\">https:\/\/stackoverflow.com\/questions\/tagged\/moodle<\/a>\n<\/p>\n\n\n\n<p><a href=\"#_ftnref5\">[5]<\/a> <a href=\"https:\/\/docs.moodle.org\/dev\/Main_Page\">https:\/\/docs.moodle.org\/dev\/Main_Page<\/a>\n<\/p>\n\n\n\n<p><a href=\"#_ftnref6\">[6]<\/a> <a href=\"http:\/\/aosabook.org\/en\/moodle.html\">http:\/\/aosabook.org\/en\/moodle.html<\/a>\n<\/p>\n\n\n\n<p><a href=\"#_ftnref7\">[7]<\/a> <a href=\"https:\/\/docs.moodle.org\/24\/en\/Philosophy\">https:\/\/docs.moodle.org\/24\/en\/Philosophy<\/a>\n<\/p>\n\n\n\n<p><a href=\"#_ftnref8\">[8]<\/a> <a href=\"https:\/\/www.w3schools.com\/default.asp\">https:\/\/www.w3schools.com\/default.asp<\/a>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What I&#8217;ve learned about Moodle Development over the last two years.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"vkexunit_cta_each_option":"","footnotes":""},"categories":[36,14],"tags":[],"class_list":["post-1218","post","type-post","status-publish","format-standard","hentry","category-development","category-personal"],"_links":{"self":[{"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/posts\/1218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/comments?post=1218"}],"version-history":[{"count":0,"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/posts\/1218\/revisions"}],"wp:attachment":[{"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/media?parent=1218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/categories?post=1218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jonesnz.com\/index.php\/wp-json\/wp\/v2\/tags?post=1218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}