Why are the Java Library source code classes not indented properly?

I have always admired the design of a lot of classes and frameworks in the JDK. I read the source code a lot to see how the developers coded a particular class, how they designed it and how they write the javadocs.

But one thing I observed was the improper indentation of the source code. Why is this so?

[317 byte] By [sri1025a] at [2007-11-26 23:41:52]
# 1

because Sun don't exclusively employ perfectionists, basically. a lot of the code in the JDK is pretty sloppy. there are also a fair few poor designs in it, so looking in the source, while useful, shouldn't really be used as a way to find The Right Way To Do Things. for instance, why is the IO package based on a bunch of abstract classes? why are InputStream and OuputStream not interfaces?

georgemca at 2007-7-11 15:10:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

> I have always admired the design of a lot of classes

> and frameworks in the JDK. I read the source code a

> lot to see how the developers coded a particular

> class, how they designed it and how they write the

> javadocs.

>

> But one thing I observed was the improper indentation

> of the source code. Why is this so?

Repeating what was said above....do not look upon the Java API as an example of how to do anything, not for design, not for code implementations and not even for code structure.

jschella at 2007-7-11 15:10:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
What has been said is especially true for the older classes like Vector and Hashtable. Newer ones have issues too but many of the original and early JDK classes are really bad.
dubwaia at 2007-7-11 15:10:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 4
> The Right Way To Do> Things. for instance, why is the IO package based on> a bunch of abstract classes? why are InputStream and> OuputStream not interfaces?why should they be interfaces and not abstract classes? please englighten me,
theeFEIa at 2007-7-11 15:10:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

> why should they be interfaces and not abstract

> classes? please englighten me,

By using abstract classes it forces any implementation to inherit directly from these classes. You cannot extend another useful class and make it an OutputStream, for example. The workaround is to use composition to wrap the other useful class in an instance of a custom OutputStream which is often what you'd be better off doing anyway. But this isn't always convienient and may not be feasible in some circumstances.

dubwaia at 2007-7-11 15:10:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 6

> > The Right Way To Do

> > Things. for instance, why is the IO package based

> on

> > a bunch of abstract classes? why are InputStream

> and

> > OuputStream not interfaces?

>

> why should they be interfaces and not abstract

> classes? please englighten me,

stop trolling, dafei. don't you have anything better to do than this?

georgemca at 2007-7-11 15:10:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 7

I hereby declare this thread dead. once daFei has got his claws into it, it will degenerate into total nonsense, with endless quotes about "best practice says your classes should both implement an interface and extend an abstract class" and endless re-definitions of previous posts until he is "right". as usual. yawn. bye

georgemca at 2007-7-11 15:10:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 8

> I hereby declare this thread dead. once daFei

> has got his claws into it, it will degenerate into

> total nonsense, with endless quotes about "best

> practice says your classes should both implement an

> interface and extend an abstract class" and endless

> re-definitions of previous posts until he is "right".

> as usual. yawn. bye

Perhaps not. The particular incarnations of late seem to disappear very quickly. Maybe someone is ARing right away.

jschella at 2007-7-11 15:10:13 > top of Java-index,Other Topics,Patterns & OO Design...