I'm confused about when to make a Java class a:
- Static nested class
- Top-level class in the same package
- Top-level class in another package
For example
class School {
static class Grade {
static class Class {
static class Student {
}
}
}
}
Is this a logically good design? It puts objects in logical layers. If classes aren't nested in this way, the logical layers pollute the namespace. A student may go elsewhere. Would creating a package for Student make it better?
Should this structure be nested or flattened?