ElearningWorld.org

For the online learning world

Elearning WorldMoodleMoodleBitesTechnical

An unexpected editor

Introduction

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.

Disclaimers

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.

References

Installing

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.

Impressions

It’s project based, and can import existing code:

Netbeans new project

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:

Netbeans navigator

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:

Netbeans search

Configuration

To conform with the Moodle coding style (docs.moodle.org/dev/Coding_style), I did have to change the editor settings:

Netbeans 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:

Java in Netbeans

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):

Netbeans 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.

Conclusion

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.

Gareth Barnard
Latest posts by Gareth Barnard (see all)
blank

Gareth Barnard

Gareth is a developer of numerous Moodle Themes including Essential (the most popular Moodle Theme ever), Foundation, and other plugins such as course formats, including Collapsed Topics.

One thought on “An unexpected editor

  • Nice post Gareth.
    I encountered NetBeans many years ago (when I used Windows) and I know it’s been around a long tome – which is usually an indicator of a good app.
    Thanks for sharing the tip about configuring it to match Moodle code requirements – that’s useful.

    Reply

Add a reply or comment...