Where to start Moodle API?

Re: Where to start Moodle API?

by Andrew Lyons -
Number of replies: 0
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Daniele,

Good question, thanks for posting.

For me personally when I started to learn Moodle I started as others have suggested with implementing a new module, block, or report. I asked others for good examples of similar existing plugins to see how they were structured.

Moodle has been around for many years and so you have to be careful which module to pick. For example, the forum code is some of the oldest and hasn't (yet) been updated to use renderers and renderables. It also doesn't meet much of the coding style and has some very complex sections of code. Similarly, although the quiz is extremely well written and maintained, and has a fair amount of good documentation, it's probably not a good one to start with (sorry Tim Hunt) because it's an extremely complicated module. If you're looking to write a new module, you'd do well to look at the workshop and assignment plugins.

Also, as David says, make use of your tools. I personally don't use an IDE (I use ViM), but I'm at one with the editor, and I have made sure to learn as much as possible of Git too. I know that I can do things like quickly use git grep to find where a function is defined (sometimes quicker than some IDEs can do so), or use git blame to find out where a line of code originated from so as to understand it's original intent.

Another thing you can do is to look at the unit tests. For the most part, our unit tests are fairly new (certainly in comparison to some parts of the code), and mostly follow the current coding style guidelines.

Hope that this helps,

Andrew

Average of ratings: Useful (2)