Starting Moodle Development

This article is a summary of some of the many things I’ve learned since getting into Moodle development in a more or less serious way.  It may be of use to others starting down this path.

Introduction

As a user, teacher and lecturer of programming languages from FORTRAN IV to Java I’ve long been interested in the topic of Moodle development, but every time I have started I’ve hit some kind of wall:

  • Lack of (or outdated) documentation
  • Lack of detailed PHP knowledge
  • Lack of help and support
  • Difficulty in understanding the source code

Then in frustration I’ve given up.

This last year I published my first Moodle plugin to the database and I’m deep into my second.  I’m still not a fully-fledged developer but I do understand a lot more than before.  So much so that I’m helping to facilitate a MoodleBites course in the subject  [1].

Motivation

One of the things needed to bring about this change was motivation.  I’d been working with people who were developing Moodle courses making extensive use of the Lesson Activity in Moodle.  It’s not a bad activity but it does suffer one serious shortcoming – you cannot use questions from the question bank in a lesson.

I began to Google around and pretty soon discovered that this had occurred to people before and they had not been able to solve it yet, mostly through lack of time.  Being in my late 60’s time is not as much of a luxury as it used to be for me.

Guidance

Stuart at HRDNZ knew that I was interested and offered me a place on Justin Hunt’s MoodleBites for Developers Level 1 course.   Justin is “the POODLL guy” – the smart Moodle Developer of the POODLL series of plugins (among others), especially good for language learning [2].

Although the course covers much of the basics of Moodle development (by no means all) it also teaches the value of persistence – or should I say without persistence you will find it hard to complete.  This is not the nature of the course material or the skill of the facilitator, rather it is the nature of the challenge.

Persistence

Persistence for me was, when faced with a challenge, not going first to the forums and getting the answer but working back and finding out where I had strayed from the path.  Experienced Moodle Developers have all sorts of tools at their disposal.  All I had was echo and var_dump.  Echo allows you to print things at your console (you can also log messages to your error log). Var_dump allows you to see the “guts” of an object and work out what you should be doing with it.

Armed with these simple tools I would go back over my code and figure it out for myself, resulting in those wonderful “ah hah” moments.  When you have those, by the way, don’t forget top put them in your Evernote or whatever you use for a log.

I’ve sometimes puzzled for days over some piece of code and this has led to a broader and deeper understanding of Moodle structure and coding norms.  Even some of the documentation at Moodle org started to make sense.

Support

There is, of course, an endless amount of knowledge already on the internet about Moodle, PHP, JavaScript and other technologies.  So much in fact that you sometimes have to be pretty skilled to find the missing piece you are looking for.

Obvious sites are:

  • The Moodle General Developer forum [3]
  • Stack Overflow [4]
  • The Developer documentation [5]

Less obvious routes include looking at GitHub for Moodle HQ and other developer’s accounts and studying the code of any plugin somewhat similar to the one you are trying to build.

The Moodle database will also help you understand what variables/properties belong to which classes/objects and gain a deeper understanding of what your code is actually producing.  I have found this especially useful when trying to understand how my plugins store media files.

For a really quick but excellent overview of Moodle architecture, you can read Tim Hunt’s guide [6].

Action

As many people will tell you, learning by doing Moodle development is better and more effective than learning by reading about Moodle Development.  In fact Moodle is built on the philosophy of social constructionism [7].

If you see an error message as an example of feedback on your learning, a challenge to be googled, rather than as an obstacle to your progress you will learn more effectively.

Pre-requisites

We’ve already mentioned personal traits such as persistence to which we can add optimism and a sense of humour.  However, you will also need:

  • A sound knowledge of programming (preferably in PHP, preferably Object Orientated)
  • A good understanding of SQL and relational databases
  • A good understanding of html and css.
  • An understanding of JavaScript.

It’s true that if you are not familiar with all of the above technologies you can learn as you go.  A good source of basic knowledge is at the W3Schools website [8] which may help if you have some gaps.

Good luck!

[1] https://www.moodlebites.com/mod/page/view.php?id=24546

[2] https://poodll.com/

[3] https://moodle.org/mod/forum/view.php?f=33

[4] https://stackoverflow.com/questions/tagged/moodle

[5] https://docs.moodle.org/dev/Main_Page

[6] http://aosabook.org/en/moodle.html

[7] https://docs.moodle.org/24/en/Philosophy

[8] https://www.w3schools.com/default.asp

Richard Jones
Follow me

Richard Jones

E-learning consultant at HRDNZ
Richard has a long history of working with e-learning and educational technology in the UK, Portugal, Singapore, China, Australia, and New Zealand.
Richard Jones
Follow me

Latest posts by Richard Jones (see all)

blank

Richard Jones

Richard has a long history of working with e-learning and educational technology in the UK, Portugal, Singapore, China, Australia, and New Zealand.

Richard Jones has 3 posts and counting. See all posts by Richard Jones

3 thoughts on “Starting Moodle Development

  • 11th April 2018 at 7:48 pm
    Permalink

    That’s such a great personal reflection on what it takes to start in Moodle development Richard ! I guess many people might think “It’s too hard for me” – but I think you’ve shown that although it’s not easy, it is possible, and anyone involved with Moodle, who has a programming type background, really can learn the Moodle approach, and requirements, and start on their journey.

    Reply
  • blank
    13th April 2018 at 3:37 am
    Permalink

    Hi Richard,

    With your “Pre-requisites” then actually when starting out then you don’t actually need the last three and the first could be shortened to ‘An understanding of programming, perhaps with OO knowledge’. When I first wrote Collapsed Topics I knew nothing of PHP, a little HTML and certainly no JavaScript. The first versions of the format did not go near the database but rather operated on a ‘cookie’ for the toggle state.

    Ok, to be fair at the time I did have a computing degree and many years of programming experience, so learnt PHP etc. from that grounding. But you can develop for Moodle without using JavaScript or going near the Database. And indeed Moodle is semi-OO and has quite a bit of functional programming elements too.

    Gareth

    Reply
  • blank
    13th April 2018 at 8:52 am
    Permalink

    Hi Gareth

    Yes, once you have knowledge it’s hard to to be specific on what others might need. I have an OO background so understanding an object and its methods is easier for me, not necessarily for some brought up in the procedural paradigm (not many of us left I appreciate).

    For SQL, html, css and JavaScript it depends on what you want to do. Get a dataset back from multiple tables (SQL), style some nav links output by html_writer::alist() (html/css), add a button to the ATTO toolbar (JavaScript) and so on.

    I take your point about Colllapsed Topics and I guess there is nothing you can’t learn if you really put your mind to it. However, bear in mind we are telling prospective participants that they need to put in 4/5 hours of study per week.

    I guess I was also referring to becoming a Moodle Developer in general rather than just the pre-requisites for the course (which are minimal for the Level 1 at least). It wasn’t my intention to put people off the course!

    Could you still write Collapsed Topics for Moodle 3 without any JavaScript knowledge? I really don’t know.

    Cheers
    Richard

    Reply

Add a reply or comment...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By : XYZScripts.com
%d bloggers like this: