For years now I’ve been developing Moodle code in Notepad++, because of its tabs and understanding of line endings / Byte Order Mark (as I develop on Windows). But recently I reflected about what I used to use and that was an Integrated Development Environment (IDE), so I’ve been trying a few out. In this process, I’ve rediscovered Netbeans, which is now an Apache project (netbeans.apache.org), and thought it would be a good thing to share my thoughts.
All screenshots are from Netbeans 12.5 on Ubuntu .20.0.4.
I am independent from organisations mentioned and am in no way writing for or endorsed by them.
Names / logos can be trademarks of their respective owners. Please review their websites for details.
The information presented in this article is written according to my own understanding, there could be technical inaccuracies, so please do undertake your own research.
- AMP – en.wikipedia.org/wiki/List_of_Apache%E2%80%93MySQL%E2%80%93PHP_packages.
- Byte Order Mark – docs.moodle.org/311/en/UTF-8_and_BOM.
- Code completion – en.wikipedia.org/wiki/Intelligent_code_completion.
- IDE – en.wikipedia.org/wiki/Integrated_development_environment.
- Line endings / termination – docs.moodle.org/dev/Coding_style#Line_Termination and ‘core.autocrlf’ on www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration.
- Moodlebites – www.moodlebites.com.
- Moodle coding style – docs.moodle.org/dev/Coding_style.
- Mustache – mustache.github.io and docs.moodle.org/dev/Templates.
- Netbeans – netbeans.apache.org.
- Notepad++ – notepad-plus-plus.org.
- OpenJDK – openjdk.java.net.
- PHP – www.php.net.
I don’t want to explain in detail what I did to install Netbeans as that would re-invent the wheel, but on Ubuntu in a shell, I typed:
sudo apt install openjdk-16-jdk
as Netbeans requires the Java JDK in order to work, even if you’re developing PHP. Then after making the install file executable:
sudo sh ./Apache-NetBeans-12.5-bin-linux-x64.sh
For some reason OpenJDK 17 was not supported, and yet on Windows it is, strange. However, if its not broken, then don’t fix it.
It’s project based, and can import existing code:
This then can give you a list of projects, which is great for compartmentalisation, but also means that you can have more than one file open from different projects at the same time and be able to transpose code between the two, improving the process of bug fixing and enhancements.
Then there is one thing that can really help that I’ve not seen anywhere else, is that classes are read, parsed and shown in a ‘Navigator’ which lists the methods etc. This helps to navigate around large classes:
and of course, syntax highlighting helps too.
There is a powerful search facility, where you can search across different scopes (I mainly use the project scope) to find where you’ve used things. When searching for elements in core code though, I tend to use Notepad++ across all of the PHP / Mustache (mustache.github.io/) file to find CSS classes and thus understand where something is output as a means to discovering how to override that output:
To conform with the Moodle coding style (docs.moodle.org/dev/Coding_style), I did have to change the editor settings:
Where I’ve set the tab size to ‘4’ and the right margin to ‘132’.
Not just Moodle development
As Netbeans (like other IDE’s) supports other languages, then once you’re familiar with it, then you can then write in other languages, such as Java:
which is the language I first used many moons back when I discovered it. Here is a small program I wrote to calculate the start and end dates of the courses I facilitate on Moodlebites (www.moodlebites.com), when I know easily which week is which. Having the Java JDK underpin Netbeans also means that you can run and debug the Java code directly, so great with small programs like that and as a learning environment. There is integration for running PHP and connecting to its own / other web servers, but I’ve not tried that as I prefer to use a separate ‘AMP’ setup and browsers, along with debugging methods not involving the IDE.
Not the whole picture
A tool however is just that, a ‘tool’. There is no substitute for the knowledge of the human in being able to perform software engineering. Netbeans as a ‘tool’ just helps you to be more productive in doing so, as it also has the feature of ‘code completion’ (en.wikipedia.org/wiki/Intelligent_code_completion):
No farewell to Notepad++
I’ll still be using Notepad++ though, as I’m used to it, along with its search facility. It and Netbeans can cope when another editor changes a file that it has open.
I’m really beginning to like Netbeans all over again. The only thing lacking is understanding of Mustache files (mustache.github.io and docs.moodle.org/dev/Templates), but as with all things, there are plugins, so perhaps one day that will happen.
What do you think? Please let me know in the comments.