Hello, I know how to work with Moodle quite well as an admin but want to have more competence in the programming side. There are many free MOOCs on coursera and edx for basic programming. Should I take one of these first? For example, one on Java? Or is there a better place to start? Thanks!
For learning the general principles of programming, many people do recommend Java as a good starting point. It's a mature, fully-featured, object oriented programming language.
Moodle's back end is written in PHP. If you want to get started with writing and editing code for Moodle, I suggest starting out on Moodle. Here's a tutorial on how to write a simple block plugin: https://docs.moodle.org/dev/Blocks
Here's a helpful integrated development environment IDE: https://netbeans.org/downloads/ (PHP version)
Here's an easy to install and manage localhost server to do your development on:
- Windows: https://bitnami.com/stack/wamp + https://bitnami.com/stack/wamp/modules#moodle
- Mac: https://bitnami.com/stack/mamp + https://bitnami.com/stack/mamp/modules#moodle
- Linux: https://bitnami.com/stack/lamp + https://bitnami.com/stack/lamp/modules
All free and open source software, of course
There are many alternatives that other Moodlers may suggest too. All worth exploring to see which suits you best.
I hope this helps!
Learning Java is a good preparation for programming in general, but on balance I recommend diving in and messing directly with PHP. Then experiment with a plugin, e.g. remove a button or field, add it back in again in a different place and generally experiment. Then set yourself a small goal (e.g. add a new help button to something) and see if you can achieve it.
Matt has made some excellent suggestion there, Netbeans and XAMPP under windows is my environment of choice. Moodle HQ is currently considering/working on a new developer course so keep your eyes out for that.
Thanks! I'll do that exact thing!
excellent, thanks Matt!
Apparently they now have a "beginners" course and a more advanced one for people already familiar with the basics of PHP code. And no, I don't work for them! Just a (mostly) satisfied former student of theirs.
Personally, I consider PHP a "dangerous" language to start programming. Is careless about many things that compiled and strong typed languages, like Java, are not. So, it may lead to bad practices, that you will see that other languages do no accept.
I'm not saying PHP is bad (actually, is great, almost always), but take care of the "lazy" habits that you may adopt because of startig to program with PHP.
In any case, I suggest you also Tim Hunt's Moodle chapter of The Architecture of Open Applications book. Provides a quick and complete perspective about plugin development for Moodle. I found it very useful when I started to develop plugins.
Are you referring to https://moodle.org/plugins/local_codechecker?
I got a bit of a shock when I ran my code through that! Taught me a few things... Great tool.
That's the one (from Tim Hunt and Eloy LafuenteEloy Lafuente) .
Another cunning trick is to ensure your code runs with PHP7 as there are some very small quirks that will catch (e.g. duplicate function parameters). So long as you don't use PHP7 specific features you will be fine with earlier versions.