I propose a change to the Java language This is a really minor tweak, but I would like to add three new keywords to class data definitions:
- readwrite - automatically generates "invisible" getter/setter methods
- read - automatically generates "invisible" getter method
- write - automatically generates "invisible" setter method
I was thinking of this yesterday while I was adding JavaDoc comments to all the classes that I have written for a client - but, I skipped commenting the getter/setter methods.
Then, I started thinking about how much cleaner the code would be without having to expressly write getters/setters - just add a keyword like this:
private readwrite String lastName;
Smart editors like Emacs and IntelliJ could show variables with one of these three keywords in a slightly different color, as a reminder to the programmer that "invisible" getters/setters are available.
One of the things that I really like about Common Lisp is how concise code is - 1000 ines of Lisp code generally does a lot more than 1000 lines of Java or C++ code. A smaller codebase makes for easier maintenance and modifications.
8:22:01 AM
|