Merits/Reasons for using "get" as a prefix in the name of an accessor method
java, oop
Solution
'get' prefix (or 'is' for methods returning booleans) is a part of JavaBean specification which is used throughout the java but mostly in views in web UI.
length() and size() are historical artefacts from pre-javabean times; many a UI developer had lamented the fact that Collection has a `size()` method instead of `getSize()`
Problem
I know that in Java, it is common practice to use "get" as a prefix to an accessor method. I was wondering what the reason for this is. Is it purely to be able to predict what it is returning? To clarify: In some java classes (eg `String`) a variable like length can be accessed by calling "length()" rather than "`size()`". Why are these methods written like this, but others like "`getSomeVariable()`"? Thank you for your time. Edit: Good to see I'm not alone about the confusion & such about the size and length variables