The story behind Java swing and SWT

Source: Internet
Author: User
Tags netbeans

  Annotation: This article from the straight_talking_java@yahoogroups.com discussion group, has been more than a year ago. Alan William son is an editor of Java developers Journal. The following is a message source from him at IBM. I have seen a lot of SWT and swing debates, and there are also a lot of netbeans and eclipse. The translator's translation of this article is not a matter of dispute or support (although I did stand on the SWT side), not to attack Amy. My most important reason is that this is an interesting article. There are insider, informant, company politics, monopoly giants, beautiful women, and business situations ...... Enough to make a movie. Interesting. That's enough. However, this article reflects IBM's views on swing and the origins of SWT. It is still a little nutritious.

To figure out why everything is so messy, let's start with the fact that only AWT existed a few years ago. Sun has established a set of basic portable control classes which are mapped to native widgets on different operating systems. Obviously, we should continue to enhance this model in the next step, in addition to the initial CUA 92 component (text, buttons, and so on), add tables, trees, notebooks, slide blocks, etc ...... At that time, AWT was full of vulnerabilities, far from being reliable. Sun's coder was also needed to fix them. Sun developers such as Graham and Otto are always used to publicly blame their bugs for operating system differences, such as "different focus order for Windows and OS/2" or ...... The behavior between Ctrl-X is different, "and other pale tokens, so that the firepower of criticism can be removed from Sun's early release of the Code. Then Amy
Fowler came to sun. Not my malism, Amy is a smart beauty. Most developers who only know the technology will be held by her. Amy is from a Smalltalk company called objectshare, where she is responsible for the UI class library.

Compared with Java, the history of Smalltalk is a little miserable. At that time, there were three huge Smalltalk companies-IBM, PARC-place, and digitalk. In the early 1990s S, the market share of the three companies was roughly the same, and life was wonderful. Parc-place adopts emulated widgets (swing) design, while IBM and digitalk use native widgets ). Later IBM overwhelmed the other two, so they planned to merge them into one, assuming Parc-place digitalk. Then, when they tried to integrate their products into a project called Jigsaw, a war broke out, and the plan failed due to political reasons (developers have actually made it work ), the only reason is that the native and the counterfeited factions are dead.

Amy won the spiritual victory, but at IBM we won all their businesses, because the two companies did nothing except quarrel during the year. When the dust settles, PPD (PARC-place digitalk was renamed objectshare at the time, which is the same as the reason why Windscale was renamed Sellafield-Let people forget the previous disaster) the stock price fell from $60 to less than $1. They were delisted by NASDAQ because of fake reports, and then disappeared. At this time, Sun is taking a similar technical direction as PPD, so all the PDD technicians sent their resumes to sun. Amy was hired and promised to solve all the window component problems through a lightweight solution, so she persuaded Sun's management to turn her head on the GUI development department. She came in with the key "the original people are screwed up here, and I am here to solve it. Amy then hired all her old friends in Parc-place and asked them to develop swing.

Obviously, what swing should do is to become a rendering framework for those who want to create map software or drawing software. In any case, it should be built around the AWT class library, buttons and other things are still managed by AWT. Sun's people, such as Philip and Mark, have enabled awt to Process Tables, trees, and notebooks ,?), Therefore, the direction of swing should be obvious. But those who have destroyed PDD do not, they have to make everything lightweight. The ignorance of Sun's management layer, coupled with Amy's relentless political means, has created the chaos we have seen today. Amy also convinced sun that swing was developed jointly with Netscape as part of the Mozilla project. In fact, it was only her propaganda strategy.

At IBM, we hated swing from the first day. Huge, full of errors, and ugly. Originally, our tools such as visualage for Java were written using Smalltalk (using native window components). Therefore, when we migrate these tools to the Java code library, we need a set of window components. The developers on the IBM side are the ones who used to engage in Smalltalk. We are reluctant to use swing to build WebSphere Studio Tools for management. Swing is a terrible and flawed monster.

In the initial preview of WebSphere Studio, when compared with Microsoft Visual Studio, all our customers hated it because of its appearance, no matter how powerful its functions are. Most consumers will not buy an ugly car, even if it has an outstanding engine. So we started a project to port our Smalltalk native window component to Java. This project was developed by the object technology international team in Canada. This project was successfully applied to the Visual Age Micro Edition product we released.
Micro Edition later became a very successful IDE in the Development of j2s. However, OTI found that swing had very serious defects in reading windows events and we could not even perform SWT (S was short for simple, but then changed to standard) and swing. They used a possible memory vulnerability when reading the event queue, so we had to use our own Windows event queue query loop to correct this error.

We tried sun again and again to fix this error, but Amy couldn't hear it, so we decided that SWT and AWT/swing could not coexist. We even defined our point and rectangle classes in SWT-the entire toolkit has no dependency on AWT or swing. We put this Toolkit into eclipse. This is a tool platform. Its overall design goal is to defeat Micrsoft and Visual Studio. Eclipse is open-source, so anyone can build their own things on it. We have migrated companies like togethersoft and rational to it. Our competitors are Microsoft, so all our efforts and attention are positive for Microsoft.

In any case, sun is very dissatisfied with this. Their netbeans and eclipse are doing the same thing, so they complained to the IBM leadership. They think that SWT is binding you to windows, which is purely nonsense, because SWT can run on MAC/Linux Through GTK, and a lot of embedded platforms. They refuse to allow eclipse to obtain Java certification. Because there is native code in it, eclipse products must carefully use the sun trademark "Java. Eclipse cannot even call itself a Java ide. Sun has threatened to take legal action to prevent IBM from calling eclipse a Java
IDE. One of the results is the GUI Design tool created by IBM on Eclipse. It allows you to build a swing/awt gui, but does not allow you to drag and drop SWT window controls.

It is entirely possible to separate SWT from eclipse. You only need to extract the dll library and put it in the path, and use the window component toolkit to develop a GUI for your bank, insurance, or other applications. Again, we cannot proceed further because Sun has bound our hands. Although CPL allows us to provide such a solution as part of the eclipse open source protocol, Sun has clearly indicated that they do not want us to do so. For the user community, no matter what the final motives IBM and Sun are, I find it always interesting: people who love Swing always say, "Once you spend several years mastering it, you can use it correctly. "Basically, they are trying to prove and maintain dedicated technologies with limited use. What SWT advocates say is," wow, this is really fast. Like the native one, it can also use XP skin ...... It is light and small ". One of our users said that swing is like Java deciding not to implement native I/O through the operating system, but to read the sector of the disk by itself through the head motor API. Swing is basically like this. It uses a bottom-layer "painting (graphics)" method to draw all the window components by itself.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.