javavscode
javavscode copied to clipboard
Consider omitting all comments from generated source files by default
Hi!
Generating a new Maven project, we are greeted with a file like this:
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package org.example;
/**
*
* @author zimmi
*/
public class Example {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
For the target audience of javavscode (students, frontend devs taking a peek at the backend etc.), half of the lines are noise:
- If they are at a stage where their project requires license headers in every file, they'll search the documentation how to set it up. It's great that NetBeans makes this easy, but getting reminded of it with every new file will either lead to extra work deleting the comments every time until they get annoyed enough to figure out how to turn it off, or worse, just leaving them as is.
- It's arguable that the
@authortag is useful at all. Especially in beginner projects with a single author, it just detracts from the important bits, the code. Therefore, it shouldn't be generated by default, IMO.
Taking this into account, the generated class should just be:
package org.example;
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
Naming the class containing the entry point Main seems to be a common practice, so I'd argue to do this as well.
The same reasoning applies to java source generated through Java: New from Template... as well:
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package org.example2;
/**
*
* @author zimmi
*/
public class Test {
}
This is a fresh start, let's present Java in the best light possible.