Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I hear people talking about the "Sun defect", often giving the whole mess around logging as an example.

How is it different from the not-invented-here syndrome, which means uselessly duplicating existing work?


migration rejected from stackoverflow.com Dec 26 '13 at 3:13

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as unclear what you're asking by gnat, Bart van Ingen Schenau, GlenH7, World Engineer Dec 26 '13 at 3:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Do you refer to that : lwn.net/Articles/370157 ? Or the top-down approach in their software design that lead to have 100+ members function to a jcheckbox ? Or maybe the way thay handle features that everybody else would call a bug like here : bugs.sun.com/bugdatabase/view_bug.do?bug_id=4391434 and here : bugs.sun.com/bugdatabase/view_bug.do?bug_id=6938627 ? Precise your question please, sun has enough defect to not be able to know which one you are talking about. –  deadalnix Jul 3 '11 at 16:11
@deadalnix That argument about java.io.tmpdir is pretty trivial. –  NickC Jul 3 '11 at 16:28
@soc You can improve the question by providing some more context around the term "Sun defect", since people here seem to be unfamiliar with it. –  Anna Lear Jul 4 '11 at 15:50

3 Answers 3

The "logging mess" in Java most likely refers to that JDK 1.4 introduced a logging framework that was inspired by the then de-facto logging framework log4j, but not compatible.

There was loud voices that they should just have adopted log4j - which seen in hindsight would have saved a lot of trouble - but JDK 1.4 logging can do things that log4j couldn't at that time. All in all this has resulted in numerous logging frameworks trying to deal with this duality and dealing with the new API's trying to fix the duality. These days the best bet is to write new code against the SLF4J API and then let the deployment people figure out which backend to use.

I do not know why Sun did not pick up log4j, but a qualified guess would be that JDK 1.4 logging is a formalization of an existing logging framework inside Sun, probably coming from their C world. In my personal opinion the JDK 1.4 logging framework was not done by an experienced Java person or some decisions would have been done otherwise. It could also be that log4j was not under a usable license (as other C libraries are being used elsewhere).

Licenses are probably the largest cause of redoing the works of others, simply because their code cannot be used as the licenses are incompatible. If you doubt this, consider asking your boss to use a GPL library in your main product and see what the lawyers say.


Can you please cite a reference to some discussion where "the Sun defect" is used in the way that you are asking about.

I did a Google search and there are remarkably few hits for the phrase "the sun defect", and the only vaguely relevant examples I could see were in relation to some specific Sun Bug Database entry.

Afaik it is more about Sun not reusing third-party code for political/internal reasons and writing their own version instead, but introducing some defect the original version didn't have.

Can you please cite some discussion to support this. I've never heard of it, and as others have confirmed, it doesn't show up in Google searches. (Well actually it does now ... but that hardly count!)

If this is all that "the Sun defect" is supposed to mean, then you've already answered your own question.

Note: I'm not saying that it doesn't occur. However it is easy to point the finger and say "NIH syndrome" when the true cause of a misfeature is not actually known or even knowable. And it is easy to pick/ holes in some design in retrospect.

One thing that a lot of people fail to realize is that design mistakes in Java are really hard to fix without damaging what makes Java so attractive to business; i.e. the platform's stability & backwards compatibility. So, when mistakes are made (and they are ... because engineers are only human) they tend to stand out like a sore thumb.

This should be a comment... –  Dean Harding Jul 3 '11 at 10:40
I disagree. It is answering the question by disputing that "the Sun detect" is a term that is in common usage. –  Stephen C Jul 3 '11 at 11:15

I couldn't find what you mean by the term in google.

There is still plenty of code in the JDK which which has not been maintained to best practice. However the major of what you would use will do what you need and there is no good reason to redevelop it.

I have written a number of low level frameworks which do the same thing as what is available in the JDK but a different way to solve a specific problem but I would say they have limited application.

Many developers are motivated money and they tend to find existing solutions to get a job done, but many are strongly motivated by the technical challenge. Sometimes this desire for a technical challenge results in a re-inventing of the wheel. There are companies which develop new and better wheels, but most re-invented solutions is no better in the long run. (true of many products IMHO)

You want to have a balance between re-use and a willingness to produce tactical solutions, as a well a balance been making money and finding a challenge. ;)

Afaik it is more about Sun not reusing third-party code for political/internal reasons and writing their own version instead, but introducing some defect the original version didn't have. –  soc Jul 3 '11 at 10:47
Most of the poor code in the JDK is from included code. About half the classes are from various included libraries. Some libraries were copied as is with only the packages changed, however some libraries like the concurrency and swing libraries were re-written for better integration. –  Peter Lawrey Jul 3 '11 at 10:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.