Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Term to distinguish "default" vs "made-up" classes in OOP

arraylists, buffered reader, scanner, etc.. all "Default" classes that "already exist" in the language..

unlike, say, public class widthOfTable which would be a "made up" class , that " did not already exist in language"..

why is there no term to distinguish these ideas when teaching? I barely discovered this difference in college , despite being here 3 years.

like image 893
user3349184 Avatar asked Nov 28 '25 16:11

user3349184


2 Answers

Actually, there is a pretty strong distinction between what you called "default" and "made-up" classes, which has to do with their package names.

All "default" classes are in some java.* package (java.lang, java.util, etc.), and no "made up" class could use a package name that starts with java..


As for the fact that this distinction is blurred "when teaching", my feeling is that it's intentional. Java as a language is pretty much a set of keywords and syntax rules plus a java.lang.Object class that nobody could avoid extending (and which uses a few other built-in types like String, Integer and some exceptions).

The JDK is a Java library to help you with the most common use-cases, but in some cases there are better alternatives.

In my opinion, it would be a mistake to teach someone that java.util.Calendar or the java.util.logging stuff have any advantage over JodaTime or SLF4J just because they're in the classpath by default.

like image 75
Costi Ciudatu Avatar answered Dec 01 '25 05:12

Costi Ciudatu


I had the same question in my mind before and i had a different term for your word default and I called them built-in classes.

why is there no term to distinguish these ideas when teaching?

there is already but taught indirectly using the terms packages and namespaces

if there is a time that you will design a programminng language you can tell any developer what are those default or built classes by putting them in right packages and namespaces for example

mydefaultclasses.io.print
mydefaultclasses.io.read

in java its really understandable that any classes under java namespace is a default or built-in class. it really depends upon what will came up on the documentation of the language you are trying to learn.

like image 20
Netorica Avatar answered Dec 01 '25 06:12

Netorica



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!