moodle development question and tim hunt book contribution

moodle development question and tim hunt book contribution

by Johnson Mafoko -
Number of replies: 8

hi anyone who has an updated version of tim hunt's explanation of moodle architeture given here http://www.aosabook.org/en/moodle.html . The explanation is a bit outdated for the current version of moodle, 

Average of ratings: -
In reply to Johnson Mafoko

Re: moodle development question and tim hunt book contribution

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
There is no updated version. Because it is very high level it is still very relevant. Which bits look outdated to you?
In reply to Marcus Green

Re: moodle development question and tim hunt book contribution

by Johnson Mafoko -

thanks for your reply. i thought using local folder to store plugins was outdated and calling  

require_login() . let me try the example code, i guess you are right. tim hunt article's is the 
most succinct explanation how moddle works imo,
In reply to Johnson Mafoko

Re: moodle development question and tim hunt book contribution

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I just noticed that the AOSA site does not give the publication date of the book! Yes, it is many years old now. However, quite a lot of it is still relevant, even though other aspects of Moodle design have moved on. (E.g. if I was writing it today, I would talk about templates, not renderers.)

Local folder is not outdate. It it still a very useful plugin type. Moodle has many different plugin types (https://docs.moodle.org/dev/Plugin_types) each for a different purpose.
Average of ratings: Useful (2)
In reply to Tim Hunt

Re: moodle development question and tim hunt book contribution

by Johnson Mafoko -

Hi, I managed to make the example work! I had to change version numbers to make lang/en translations to work. Great article by the way. Kudos 

In reply to Johnson Mafoko

Re: moodle development question and tim hunt book contribution

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
A more up-to-date thing is "Moodle Plugin Development Basics" at https://learn.moodle.org/. That might be worth a look too (if you have not already found it).
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: moodle development question and tim hunt book contribution

by Johnson Mafoko -
Hi I just discovered that the following code print a simple hello world without having to know all about plugins(and thats what a newbie needs before delving further). 
hello.php
------
require_once(dirname(__FILE__) . '/config.php');
echo $OUTPUT->header(); 
echo $OUTPUT->box('Hello, world!'); 
echo $OUTPUT->footer();

I used to be a teacher, hence I tend to think in terms of teaching and learning(first overview, then simple example, then elaborate the example, then theory, then elaborate example, then theory, etc). This is not a criticism as a preference. Thanks for the link, and yes I have skimmed most of them, mostly because I am interested in theme development not just plugins. Looking at the moodle framework, I tend to think of it in terms of MVC model, but I see lots of hacks which you allude to in the article, and you seem to justify them due to social constructionist pedagogy that moodle follows. Let me ask you something:, if there is no such thing as a perfect software design(as you say) wouldn't you say moodle itself is part of open source ecosystem and hence it should have learnt good design from other open source projects: moodle is itself part of larger social constructionist pedagogy of all community based open source projects.
One last thing : do you care to elaborate on output.main_content() function(I still havent figured out what that function is doing to this day, your comments on outputrenders.php are not clear to me yet, ?).


In reply to Johnson Mafoko

Re: moodle development question and tim hunt book contribution

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The book chapter is from a book called 'The architecture of open source open applications'. The purpose is to explain some interesting aspects of how Moodle works to people who are not immediately familiar with it. The book is not called 'Moodle development for beginners'.

Why is the Moodle code not perfectly exemplary? Well, a variety of reasons:

  1. Bits of it are 20 years old. That means they were written in PHP4, a horrific language. PHP7 is much nicer (though still not acutally a nice language!)
  2. And, in the early days, a key design goal was to make a simple system that any teacher could hack on. (And, to quite a large extend they succeeded.)
  3. However, as Moodle grew, and people demanded more complex featuers (lots of flexibility for themes, more consistent navigation, better performance, ...) the code inevitable becaome more complex in places.
  4. Moodle is vast. To re-write everything in today's flavour of the month coding style would be prohibitive and would not acutally benefit users.
  5. Not least because, if it is not actually broken, don't fix it.
  6. It is not just laziness that means we don't rewrite stuff in Moodle. Thousands of people around the world have created their own Moodle plugins, or customised the code of their Moodle site. Moodle works very hard to ensure we don't break their functionality while putting out a major release every six months.
  7. Moodle constantly learns elements of 'good design' from developers coming in and out of the project who have worked on other systems. However, there is no one 'right way' to do software design. Every developer has a different opinion (believe me, I see some of the conversations).
  8. However, there are strong standards for an new code written, and automated tools and a human review process to ensure they are followed.
So, it is a complex, messy situation. But, it is the reality of large software projects.
Average of ratings: Useful (5)
In reply to Tim Hunt

Re: moodle development question and tim hunt book contribution

by Johnson Mafoko -

Hi Mr Hunt, 

Thanks for your elaborate response. You said it all.