I'm thinking about filenames which are very long and therefore considered as bad practice. For example, the RxJava project on GitHub contains a Java file that is called "CompletableMergeDelayErrorIterable.java". I'm wondering if filenames like these should be shortened in order to enhance the readability. Is there a rule of thumb? Or should a filename just be self-explanatory?
Asked
Active
Viewed 37 times
1 Answers
2
For NTFS file systems (i.e. Windows), an individual filename is limited to 255 characters. The same goes for any parts of a path, like directory names. Full paths should be shorter than the constant MAX_PATH
, which is 260 characters.
See Maximum filename length in NTFS (Windows XP and Windows Vista)?
For Linux, the maximum length is 255 bytes in most cases (depends on the exact file system used).
See Filename length limits on linux?
So yes, long file (and path) names can cause problems and should be avoided!
Additionally, very long class names make your code harder to read. If you want to convey that a class supports certain features, it should be sufficient to mark it with the appropriate interface(s) (e.g. Iterable<T>
).

Georg Patscheider
- 9,357
- 1
- 26
- 36
-
But isn't it already a problem to have more than 25 or 30 characters in a name? It really affects the readability in my opinion. – Max Dec 10 '18 at 15:06