Swing 107
Swing | |
author | Matthew Robinson and Pavel Vorobiev |
pages | 917 |
publisher | Manning Publications, 08/1999 |
rating | 10/10 |
reviewer | Jayakrishnan (JK) |
ISBN | 1884777848 |
summary | Unique examples and the exhaustive coverage of Swing make this a valuable book for both beginners and advanced programmers. |
How many times have you opened a book in search of a solution and found not only an answer, but also an elegant enhancement to your application? How many times have you ignored an O'Reilly book on the same subject lying on your table? The answer is Manning's new book Swing authored by Mathew Robinson and Pavel Vorobiev. And that is my final answer.
The book (with just a 5-character title) is 917 pages long and is divided into four parts containing 23 chapters, an appendix and a bibliography. The first part, "Foundations," introduces Swing, its architecture and the key mechanism underlying Swing. Part II, mysteriously called "The Basics," explains the most commonly used and simpler classes of the Swing toolkit like labels, buttons, menus, list boxes, progress bars and sliders. The third part of the book, "Advanced topics," deals with using complicated components like trees, tables, text components and layered panes, as well as creating pluggable look and feel. The final part, "Special topics" introduces printing and the Java2D API.
Only two chapters of the final part are included in the book. The remaining four chapters which discuss accessibility, JavaHelp API, CORBA and some examples contributed by experienced Swing developers are available on the book's Web site.
The structure of each chapter is the same. Let's look at the chapter on tables as an example. The JTable class is introduced followed by related classes and interfaces. This is followed by discussions on row and column selections from JTable, column width and resizing and customizing the appearance of the table. The important methods related to these issues are discussed and short code samples are used to demonstrate the main features.
Then comes the meat of the chapter -- the examples. The first example shows how to display stock market data in a JTable. Complete code for the example is given and important sections are discussed. The examples that follow are enhancements to the first example. In the JTable chapter, they include adding custom renderers, customizing the data rendering, retrieving and displaying data from a database.
Each of the examples builds upon the previous one and as promised on the cover of the book, is production-quality code. While most other Swing books serve as expensive javadoc dumps of JFC with trivial, forgettable examples, Swing provides code that saves lots of time for the developer. The other applications that are developed in the book include a JPEG image editor, an ftp client, an X-Window-style desktop environment and a word processor.
This book is for the developer building applications using the Swing components of the Java Foundation Classes. The large number of examples make this a great cookbook providing code samples that will vastly reduce your development time. The language is simple and the examples are well defined. All the Swing components are discussed in detail with several screen shots.
The part I liked the most in this book is the section in each chapter about extending the Swing components to create custom components. These include creating an oval shaped border, polygonal buttons, and a tabbed pane which takes an image as the background. These examples provide knowledge to extend the components in ways limited only by your imagination.
The book is sprinkled with UI design guidelines by David Anderson related to usability and presentation. There is no reference to the Java Look and Feel Design Guidelines issued by JavaSoft. So I would recommend referring to that book (published by Sun Microsystems) if you want to design applications with consistent appearance and behavior.
The only minor annoyances in this book are the figures which display the component hierarchy, as they have an unprofessional look. But there are only a few of them.
To summarize, the unique examples and the exhaustive coverage of Swing makes this book very valuable for both beginners and advanced programmers.
Purchase this book at ThinkGeek.
Re:Hasn't Java had its day? (Score:1)
It is pretty hard to find a really good skier. Although a lot of skiers are good at something, few can do it all moguls, speed, techniques, etc... Same with C++, I know a lot of programmers but very very few good C++ programmers. Also most good C++ programmers are very specialized. For instance, I know a great graphics programmer but building a multi-threaded server was a huge challenge for him. He spent a lot of time reading up on pthreads. Also until you are a good skier or C++ programmer you don't have much fun. You are constantly hampered by lack of technique and cognitive overload. Too many things have to come together before you advance.
Now snow boarding was different. I picked it up very quickly and most importantly I had fun while I was learning. Java programming is very similar. Although learning to build a simple programming in Java and C++ is an equally challenging endeavor, advance programming is where java really shines.
In java building a multi-threaded server is pretty simple and adding checksum and compression is a breeze.
I have found with java the details are easy enough that I have very quickly start advance software design including design patterns and using concepts like Polymorphism and synchronized where they really pay off.
So I am a firm believer that Java's popularity as a programming language will continue. People forget, that enterprises would not touch 'C' until it had been around for a decade. Java is not even close to the 10-year mark and is very popular.
Finally the VM architecture is given unfair critics. Check your basics there is no theoretical basis why compiled code is to faster than interpreted. So yes in theory interpreted VM can be just as fast a compiled code!!
Hasn't Java had its day? (Score:1)
Forgive me if I've got the wrong end of the stick, but I was under the impression that Java had had its day and was pretty much on a downwards spiral. The basic premise of Java was an interesting one, and it was released at the best time for it to succeed, but due to various factors it hasn't, and there are few web sites where it is used.
Java was a great chance to make a C++ that people could understand without going through the mental contortions that currently plaugue it. At first glance it looks a lot nicer, but when you take a closer look it is just as bad, but with long keywords rather than obscure symbols. When you have classes peppered with "abstract", "final" and so on, and methods with "synchronized" etc. you start to wonder what exactly all this "synchronized final void foo()" is all about.
All the websites I've seen have eschewed Java in favour of CGI scripting, a more reliable alternative. Writing an application in Java requires the use of the Java libraries, which involve some pretty bizarre methods of working for anyone used to another language.
While I appreciate there are some "hardcore" Java programmers out there, can anyone point me to a real-world application or website that actually uses Java? I mean properly, not just a tiny applet showing the time or something.
Re:claims != reality (Score:1)
There's Sybase's SQL Anywhere. It's JAVA (or was a few years ago.)
You might also be surprise to know Star Office is written in JAVA.
(Yes, there are OCI based JDBC drivers from Oracle, but they were not installed/selected.)
Is Anybody Really Using Java? (Honestly!) (Score:1)
I have had a number of encounters with Java-based GUI applications, and to a piece they have all been bad. All the Java GUI applications I have tried have been sluggish, unresponsive, and generally unimpressive.
They all seem to want to install their own JRE too, so it seems like I (as a user) am being punished because the Java compiler couldn't/wouldn't generate a native binary. But yet I have to install a native-binary version, because it installs a native-binary JRE as part of the package.
I have nothing particular against Java as a language - I don't like Bondage & Discipline languages myself, but language choice is very much a personal thing, and I don't presume that my personal preferences are best for the entire world. But Java as an implementation - as I have seen it - provides a really nasty end-user experience.
Ever tried the Netscape 4.1 Admin console? Bletcherous! Horrible! Nasty! Yechh!
Is anyone out there deploying Java applications with good results? Really?
Re:Java won't ever replace C++ for me until (Score:1)
Examples: They compare the number of "classes" used in the AIC vs. delegates case. (22 vs. 1) Yet they ignore to mention that delegates are actually classes under the covers (therefore, the answer is 22 vs. 22).
That AIC's need to be compiled in advance is rather irrelevant unless you are concerned about a 2-3% development footprint hit.
They also ignore that with some simple reflection, the number of AIC required for event handling can fall dramatically.
The source code differences are 9279 bytes vs. 10842. That's a difference of 1600 bytes, mainly from AIC syntactic-junk.
MS claims that delegates can be portable. That's nice, but that also means the onus is on MS to submit it to the Sun community process.
The multicast arguments are equally skewed. So because some events may be multi-castable, that justifies the usage of a non-standard construct that works just as well as AIC's, is just as fast, and has a slight flexibility advantage?
And based on my experiences on a 6-month WFC project, delegates are decent, but I see no real benefit of them over AIC's other than the class footprints (which again can be alieviated through judicious use of reflection).
Re:Swing - Good idea, badly implemented (Score:1)
Enhydra Users: Fed Ex, Time-Warner. . . (Score:1)
http://www.lutris.com/EnhydraQuotes.html
I don't know exactly what they have built, but it's using Java.
Re:claims != reality (Score:1)
http://www.ibm.com/stories/1997/07/iw3.html
http://news.cnet.com/news/0-1003-200-320747.htm
Also, If Java is "useless" why is there so much work being done on integrating Java with Apache? Chack out java.apache.org. What are all these Java application server vendors doing? They have to be using Java for something.
Re:Java won't ever replace C++ for me until (Score:1)
class MyClass {
static final boolean debug = true;
public void mymethod() {
if(debug) {
}
}
}
want to disable all the debug code? just change the debug boolean to false. next time you'll compile, it will not compile the condition code, because since debug is *final* and set to false, he knows that this condition will always be false.
VB suffered from this problem too... (Score:1)
Small comfort I suppose, but VB'ers had to go through the same thing. I suppose C++ had this curve too. History repeats itself I guess.
OT: Postscript printing in Java? UML drawing app? (Score:1)
I assume there is a way to produce PS in Java. Which?
I want (to find or make) an UMl drawing app in Java... Where?
Sorry for OT.
It sounds like you needed to get a book ... (Score:1)
Synchronized (Score:1)
Is it just me... (Score:1)
I could probably write the equivalent program in QT/C++ in about 30 lines. Is it just a problem with swing (the API is very unpleasant), or is Java in general bad? I would have expected it to be reasonably fast on my system - but using JBuilder Foundation is terrible (click on a button - wait 3 seconds). And it's not RAM usage either - it was completely unusable with only 64MB RAM.
Why not do this:
NATIVELY compile code for platforms that support it. For those that don't, use bytecode. I'd guess this could get a MAJOR speedup.
Re:Java won't ever replace C++ for me until (Score:1)
1) Compile once run anywhere is not as important for where java is heading (server end). Please stop insulting us, and give us a native compiler sun. We are capable of compiling to bytecode when we want to use applets on webpages (noone does that anymore tho :P).
Get TowerJ. It compiles. It runs on Linux. Sun doesn't provide it, but I thought that /.ers whined when everything came from one source...
2) Give me paramterised types or templates. Writing our own collection classes and/or casting really really sucks. Some of the stuff that the folks who wrote Pizza are cool, anonymous functions for java :D! (basically lambda expressions) and parameterised types. It's even compatable with current virtual machines, just most IDEs and compilers won't like it.
It's coming. The people who designed Pizza have now designed GJ, which is going to be incorporated into some future version of Java. In the meantime, you can download the GJ compiler (and a java.util package that has been modified to work with GJ) right now.
3) Delegates, I want MS 'delegate' style function pointers in java. Anonymous Inner Classes are horrific, and spoil Swing.
Delegaes sucked. Furthermore, delegates just compiled into anonymous inner classes. No gain, there.
4) ASSERT. We need asserts!!!! Lucky J++ has a simple preprocessor. So many bugs could be caught if people used ASSERT more, Sun don't even think we need them!
Sadly, ASSERT is coming to Java. However, it's a bad idea. Cafe au Lait has discussed why this is a bad idea in the past.
In the meantime, you can write your own assert facilities. Programmers at my company did so. It'll catch problems at run-time, not compile-time, which is how I remember ASSERT working, but it's been a few years.
Anything else?
-jon
Re:Java won't ever replace C++ for me until (Score:1)
Awwww.... yet another /.er who whines when other people make them pay for their work. My heart bleeds for you.
Sun is not being stupid over the JVM. They release a reference JVM. TowerJ has written a Java->Native compiler which must include a JVM of sorts as well (things like dynamic class loading and reflection still need to work).
2) Templates are still "coming" (and have been for a while). Sun have been saying they'll integrate pizza features for over 2 years.
You have this pathetic fixation on having Mommy Sun give you all your software (and for free!). Go to http://www.cs.bell-labs.com/who/wadler/pizza/gj/in dex.html and download GJ. Use it today.
3) Delegates rock. They use classes, NOT anonymous inner classes (get a clue). They have the same overhead as making a function call - unlike AIC.
Horseshit. Tell me how, in 20 words or less, Microsoft implemented first class function pointers without violating the Java Class File Format. The article from Microsoft's Java architect has disappeared from their WWW site, or I'd pass on a link to it to you. He says that delegates compile to anonymous inner classes. What, you know better?
Here is Sun's analysis of delegates: http://java.sun.com/docs/white/delegates.html The analysis of how MS implemented delegates is given in http://java.sun.com/docs/white/sidebar.html
Yes, there are ways to hack ASSERT into java, but it usually involves using an if statement so the compiler will weed it out, rather than a simple "Assert" statement.
If you knew about HotSpot, you'd know that if branches that aren't ever taken will be compiled out. And since we're talking about long-running server processes (remember your whining about native compilers?), HotSpot's adaptive compiling is perfect.
-jon
Re:Java won't ever replace C++ for me until (Score:1)
For MS to claim that Gosling is wrong and delegates generate classes rather than inner classes is just spin. There is still going to be some sort of intermediate class automatically generated with a computer-generated name. What's the difference between that and an anonymous inner class? Nothing. What is the performance advantage? None. What was the point of delegates? Yet Another Pointless API Change for Lock-in. Yay Microsoft. I reiterate my original point: Delegates suck.
-jon
Using debug boolean (Score:1)
public interface Debug {
public static final boolean _debug;
}
public class foo implements Debug {
public void baz() {
if(_debug) {
}
}
}
public class bar implements Debug {
public void boo() {
if(_debug) {
}
}
}
(As an aside, any field in an interface is implicitly public static final. But I like to make things explicit.)
-jon
Re:One versus Many. (Score:1)
printf
Radix support for byte and short
A replace(string1, string2) method for strings
A windowing toolkit that doesn't eat all my swap space (unlike Swing)
Re:Swing - Good idea, badly implemented (Score:1)
Meanwhile, the rest of us have to sit here as Forte takes 10 MINUTES to load and another MINUTE to respond to menu selections, meanwhile eating 150 MB or so of swap space.
Re:claims != reality (Score:1)
Shipping products don't necessarily equate with wide usage. From the people I've talked to in the industry (and they represent a fair cross-section), Java is used overwhelmingly for internal use. Those coding efforts will never see the light of day publicly because they represent specific solutions to a specific internal problem. Many organizations use Java as sort of a glue-all; where Perl is considered the duct tape of the Internet, Java is more like a set of schematics and a trained team of engineers - Perl gets the job done, but Java can get the job done *right.*
What you're trying to do is equate Java's acceptance with the level of shipping products based on the language. Where your metric falls down - and will fall down with any language or utility - is if that language or utility isn't used in products that you can buy off the shelf. Java isn't used in many shipping products because it isn't suited very well towards client applications. Where it IS suited very well is on the server - a place of use that you miss completely by asking only for shipping products.
Re:shipping product != client application (Score:1)
>If Java is so great at creating the programs that fill these niches, why is no vertical market app vendor shipping a Java product to do so?
Asked and answered. These niches that you refer to are inherently specific. While you can lump them up and say, for instance, "servlets for accessing a database," the particulars vary. Company XYZ may require an *entirely* different servlet than Company ABC, because of the configuration of their database, how they intend to access and display the retrieved data, and any number of other variables. Company XYZ could package that up and ship it, but it would be doubtful that anymore than a handful of other companies would find the software useful without serious modification.
The next step above that would be to sell a generic servlet. But again, you run into the configuration issue. How much do you have to architect the servlet before it becomes applicable to more than a small handful of situations? How bloated does it have to become to encompass the vast variety of configurations out there? Many corporations would find it easier to simply write their own from scratch, ensuring that the servlet would be completely designed for optimal performance for a particular configuration.
As a result, much of the Java work that is done is done for company-specific purposes, and is not sold or otherwise distributed because it would be of extremely limited value to others without the source code to modify. It would be like the United States trying to sell the programming instructions inside a Patriot missile. Unless you *have* a Patriot missile (raise your hands, please) the code isn't going to be of direct value to you, and if you happen to have another type of missile, the Patriot code isn't going to work without serious modifications.
If you want to see what exactly is being shipped, I suggest you look at Java Solutions Marketplace [sun.com], where you can browse through the Java-related products and services to see whether anything qualifies for your stringent criteria.
>The only possible exception to the above are problems so crazy and stupid (and small) that no sane company would make a product to fix it.
You seem to want Java products that you can walk into a store and buy. It doesn't work like that. Should I dismiss Perl because I can't walk into CompUSA and buy a pure Perl software package? Perl has it's place as the glue that holds together the web. Java also has it's place in the software world - it's just not the visible, retail shelves that you are so desperate for.
>Now we're back to non-real-world uses.
I'd be interested in seeing how you define non-real-world uses. If it optimally solves a problem for a company, as far as I'm concerned that IS a real-world use (and is a much better real-world-use than some generic packaged product that has to be shoehorned into being merely an adequate solution).
The Authors do good work (Score:1)
cheers!
iceaxe
Re:Hasn't Java had its day? (Score:1)
Sure... by 2003 it'll all be RMI calls... no doubt in my mind.
shipping product != client application (Score:1)
The only possible exception to the above are problems so crazy and stupid (and small) that no sane company would make a product to fix it. Now we're back to non-real-world uses.
--
claims != reality (Score:1)
--
Re:claims != reality (Score:1)
I can name big companies, too. The point is specific examples of Java in use. Names of products that are currently shipping, for instance.
--
TogetherJ (Score:1)
They have a free(feature limited) version available
The site is http://www.togethersoft.com [togethersoft.com]
Otherwise, dia from the gnome project is looking really good, even if it's not Java...
Re:What's the frequency? (Score:1)
awt components, on the other hand, are "heavyweight". They have an operating system peer that defines their behavior and appearance. java.awt.Button, for example, looks different in windows that it does in Motif, because the actual button is created by an operating system call.
With Swing!, all the components look the same regardless of the underlying operating system. This is a good thing (most of the time).
Mike
Re:Swing - Good idea, badly implemented (Score:1)
1.3 should be better, but last I checked the only version out was for windows. This is a temporary lag while they consolidate the Solaris builds, but it still keeps me from trying it out.
BTW, Swing! keeps getting faster and faster. When I was using the original point releases, it was much slower than it is now. As it is now, any pentium 2/celeron type machine should be able to draw swing components pretty fast. Almost as fast as native code. If your app is slower than that, then you are probably doing something wrong.
Or using a builder tool, instead of doing the layout work yourself.
Mike
Noting price wouldn't hurt archive, IMHO. (Score:1)
Re:Java in Industry. (Score:1)
Re:Java in Industry. (Score:1)
Re:claims != reality (Score:1)
Perl
SCHEME LISP
SNOBOL
Ada(although I could be wrong on this one)
HTML
Javascript
XML
Just because production/shrink wrap software is not written in Java, doesn't mean that it doesn't have a place.
--------------------------------------------
Re:Book Available Online! (Score:1)
OT: NASA (Score:1)
They're very succesful at being useless and setting back the development of a real space program by at least 20 years.
Bradley
Re:Price: US-$ 35... (Score:1)
Re:What's the frequency? (Score:1)
Not that I like VB the language over Java...just putting things into perspective.
BTW, I'm not an MSCE, and I am a computer science undergrad at a unix based university.
Re:What's the frequency? (Score:1)
swing is definately here to stay as far as java is concerened. it,s lightweight component set eliminates the problems the awt had with peers now once the performance is up to snuff....
Light weight? I don't think there's ever been a toolkit that's as heavy weight as Swing.
Swing is easish to learn, the object hierachy is pretty good, but the speed and memory usage is horrific. The average swing application uses more memory than Windows 2000 in total.
BTW, The even handling is TOTALLY SCREWED.
Anonymous inner classes? PULEEEASE. My HCI professor thinks it's one of the worse ideas ever.
Why don't sun JUST ADMIT that Microsoft's java delegates (function pointers for java) were a good idea and implement them. Saying delegates are not object oriented is like saying that methods aren't 'object oriented'.
Re:What's the frequency? (Score:1)
Next time click the links before answering...
Java web pages serve faster than anything script based except mod_perl because they are memory resident via the Virtual Machine while CGi has to be read from disk. So the 10 times faster crack is simply bullshit. . Secondly why did you assume I meant I was using Windows?
Um, it will run 10 times faster. Put together the DB stuff with VB data designers, then write the web stuff using vb webclasses (compiled native binary code).
It's (mostly) not script based. The only script is some ASP that passes everything to the VB webclass.
I didn't assume you meant windows, was just talking about the speed of being able to put something together
If you aren't using windows, then I have no problem. Well I have no problem with using java for serverside stuff on Windows either.
What I said wasn't meant as an attack, just a comment.
Re:Java won't ever replace C++ for me until (Score:1)
Get it the truth about delegates from the guys who invented it.
blah [microsoft.com]
It's defintely done with classes, cause you can see the class files it generates.
Re:Java won't ever replace C++ for me until (Score:1)
I love these kinds of posts! Ignorant, bigoted people who haven't done any research...
Take that advice yourself. Firstly, NONE of these are available from Sun, like I said, 3rd party stuff that's not widely distributed is useless.
1) TowerJ is not free. And I was talking about sun stop being stupid over the JVM.
2) Templates are still "coming" (and have been for a while). Sun have been saying they'll integrate pizza features for over 2 years.
3) Delegates rock. They use classes, NOT anonymous inner classes (get a clue). They have the same overhead as making a function call - unlike AIC.
4) Why are asserts bad? You have GOT TO BE KIDDING ME.
Yes, there are ways to hack ASSERT into java, but it usually involves using an if statement so the compiler will weed it out, rather than a simple "Assert" statement.
Re:What's the frequency? (Score:1)
Almost all of VB's objects are written in C++, and VB itself has been natively compiled since version 5.
Re:Java won't ever replace C++ for me until (Score:1)
My HCI professors bawks at AIC cause of how ugly they are. People usually end up using AIC and making it just call a function.
It makes thing MUCH clearer about what is done, and code is well organised.
But I guess I can't expect Sun to respect people who want good looking code - code anyone can read (after looking at their source code, their source code commands, and their notational style).
Re:Java UML drawing app (Score:1)
Fundamentals of Object-Oriented Design in UML by Meilir Page-Jones if you want a refresher on OO along with a good UML intro (enough UML there for most projects).
UML Distilled by Martin Fowler.
The Unified Modeling Language User Guide by Booch, Jacobson and Rumbaugh.
Re:java is dead. Live with it! (Score:1)
Re:Java will find a limited niche (Score:1)
...
You have it exactly backwards, you know - it really frees the programmer to do interesting things.
I've read your reply several times, but haven't found your supporting evidence. Did you forget to include it?
Re:What's the frequency? (Score:1)
I'm back from school and can see your're still posting pro-MSFT drivel without due consideration of the facts. I have 2 friends who will be on the Visual Studio development team in the summer and even they do not take liberties with the facts like you have just done.
In a 3 tier app (DB, middleware, web) the speed bottlenecks are a.) the amount of time to do reads and writes to/from the database b.) the amount of time to send data over the network. Even if VB was 10 times faster than Java on the client (which is a bold faced lie in this age of Just-In-Time compilers that convert Java to native code) the two aforementioned bottlenecks will reduce the speed level of the entire application so that the difference between VB and Java implementations is negligible.
PS: With regards to speed of deployment, there is no contest, Visual Basic is king.
Re:Hasn't Java had its day? (Score:1)
and you should link to http://www.cpan.org [cpan.org] if anything
not http://www.python.org [python.org] for crying out loud..
---
i mean really
Re:Hasn't Java had its day? (Score:1)
I am sorry I must be imagining the 8 bazillion websites out there
Okay okay that was inflammatory and I do agree HTTP is a fairly poor one sided nightmare for client/server apps.
All of the preprocessors Php, ColdFusion
People are just pouring money into the web mostly websites and client/server apps that are mostly browser oriented, an anti trust lawsuit against MS is using browsers to attack them, there is just such an amount of websites and browser technology and money involved, its not just gonna 'die' off. You can implment new protocols maybe something better than HTTP via a plugin, but as long as the browser is in the hands of a closed corporation they will do what interests the corporation (as they should) not what interests the best thing for the rest of the world. You can just kiss idealism goodbye when you are talking about a profit margin. Anyways think about that.. I dont think web browser will go away. HTTP will die yes.. but even then the two are so closely tied its going to take time)
Re:Hasn't Java had its day? (Score:1)
Anyway, here are two java sites, Hallmark.com [hallmark.com] and The United States Postal Service [usps.com].
Re:java is dead. Live with it! (Score:1)
"Java is not dead, it just smells funny"
Re:claims != reality (Score:1)
Re:My complaint against sun (Score:1)
Re:OT: Postscript printing in Java? UML drawing ap (Score:1)
for more info.
/Adam
One versus Many. (Score:2)
Of course, in all Real Life projects, there are lots of developers working on various parts of a project. You've got to be *extremenly careful* while making a C based application with lots of developers, as there are an incredible amount of gotchas that can sneak up on you.. Spending days to hunt down an obscure but critical memory leak costs money...
Java is more strongly typed, and the built-in GC makes that memory leak less critical (yes, you can still cause leaks in Java, but they typically won't kill you like they will in a non-GC environment.) These types of features make it much easier to develop a large application with a teams of programmers with various skill levels and backgrounds.
Re:Swing - Good idea, badly implemented (Score:2)
Re:Swing - Good idea, badly implemented (Score:2)
Seriously, I bet you could probably find something out there by either doing a search, or subscribing to Java Developer Connection (at java.sun.com).
Swing - Good idea, badly implemented (Score:2)
Personally I think this is a real hinderance to Java mainstream acceptance. I've tried a number of XML editors written in Swing, and just went back to Windows or X editors instead, because quite simply they respond. Even Tk apps respond better than Swing apps, because the widgets are implemented in C, not in Java with a huge inheritance tree. Interestingly I fear this will be the same problem that Mozilla and XUL face.
Re:Swing - Good idea, badly implemented (Score:2)
I don't know how it's implemented in Java, but if it's anything like C++, then it's no big deal. It all boils down to a a funtion pointer in the vtable that really makes no great difference (on a PPro200, I was able to make of 5 million vtable invocations a second in C++, which is more than you need for UI work)
Hmmm... (Score:2)
No problems.
Yes, the UI take a while to instantiate all the objects and do all the needed set-up; I thread off an animated splash-screen and no one is the wiser that it's actually working.
Once there, the app is crisp - the slowest part is the network connection to the server. It's not as fast as C or Delphi apps, but then again, it was a piece of cake to develop the UI.
I don't know WHAT you might be doing that's so slow, but that is not my experience. Maybe trying to use Java like it was C? Comparing strings char by char? Creating new objects all the time instead of using available references? I'm not trying to pass judgement in any way - it's just that I've seen people try to use a pipe-wrench as a hammer before, and complain of bad performance.
For the record, 1.3 includes HotSpot. That made a difference. Using Swing rather than AWT, and not mixing the two, made a difference. Understanding the memory settings on the JVM - so the garbage collector isn't invoked too often, made a difference. These things help in programs larger than what you describe, but maybe JBF isn't getting started with enough JVM memory?? Just a thought.
You don't know what "lightweight" means (Score:2)
And it is. By "lightweight," Sun means that Swing components are not using native resources, but are drawn using Java only (no peers). This isn't strictly true for all Swing components (for example, JFrames need to be real frames at a certain level and popups that extend past the edge of the window need to be heavyweight to be drawn outside the bounds of their window.), but it's close enough to be approximately true.
If a 4-page cheat sheet can't cover more than 90% of the things one usually needs to do in GUI coding, the package is badly designed anyway.
As far as API size, Swing was NEVER intended to be small. It has over 2 dozen different widgets! It includes an HTML and RTF parser! A 4-page cheet sheet isn't going to cut it for anything but the very bare minimum. You couldn't adequately describe the functionality of a JTable with 4 pages. If you want bare minimum in Java, stick with AWT. There you only get a few widgets.
I tried Swing once, but discovered it was both slow and not yet widely deployed in browsers. But that was six months ago. Have things improved?
Swing in browers isn't going to be common, probably ever. You'd need the Java Plug-in installed to use it, and the vast majority of users currently have about a 28.8 connection. The 8MB download for the Java Plug-in isn't going to cut it. That's OK, because Swing functions best as an in-house, cross-platform VB app builder. Commercial apps on the order of Word or Photoshop couldn't be built in Swing right now. That doesn't make Swing useless, though.
-jon
Re:One versus Many. (Score:2)
There are several third party libs with this functionality.
Radix support for byte and short
Eh? That's been in the language since JDK 1.0.
In Byte:
public static byte parseByte(String s, int radix);
public static Byte valueOf(String s, int radix);
In Short:
public static short parseShort(String s, int radix);
public static Short valueOf(String s, int radix);
A replace(string1, string2) method for strings
It's in JDK 1.3. StringBuffer.replace(). Strings in Java aren't mutable.
A windowing toolkit that doesn't eat all my swap space (unlike Swing)
Use AWT. Or you might want to look at KFC (seriously!): (http://openlab.ring.gr.jp/kyasu/)
Any other nitpicking reasons? I know, you'll make up an excuse, but I want to see what it is ;-)
-jon
Re:claims != reality (Score:2)
I think you are wrong about Java not replacing C. C right now is used for low level OS stuff and device drivers and of course embedded machines. right now C is being replaced with C++ in most of these areas. The embedded machine domain is subject to Moore's law so with some delay the same developments as on larger computers take place there. Time to market and C are a bad combination, so other languages will find their way there if chips get fast enough.
Re:claims != reality (Score:2)
There are a lot of commercial and government installations who are using Servlets/EJB to do thier web business. Go to BEA or IBM's websites to see lists of successful implementations.
Go search a few web boards and look fr Java jobs. What are all of those people being hired for?
Java may have failed for Applets and other window dressing. It will never replace C as a systems programming language or Perl as a CGI/duct tape language. But many companies are using it for corporate IS development or web development.
Just beacuse it isn't fabulously popular in the open source world does NOT mean it isn't being used.
Re:What's the frequency? (Score:2)
Apparently you have never used the AWT, Swing's predecessor.
I'll admit Swing isn't the fastest and doesn't have the smallest footprint, but it is a big improvement.
Re:Is Anybody Really Using Java? (Honestly!) (Score:2)
As ever, performance is quite often a question of how well the code was written and designed. Java programs written by C++ coders tend to underperform for some reason.
I've seen some very clunky, very slow Java UI code from certain large, well-respected companies, where the performance is entirely down to bad coding. It's a shame that this sort of incompetence is sometimes taken as reflecting poorly on Java as a whole - it's just as easy to write lousy UI code in C/C++.
Re:Is Anybody Really Using Java? (Honestly!) (Score:2)
And yes, I have used the horror which is Netscape 4.1 Admin Console. That has to be the worst Swing app I've ever seen, at least user interface wise... if you are just adjusting values in the LDAP tree you might want to use the sample JNDI browser availiable from Javasoft [javasoft.com]. Look in the products&API's under JNDI, the browser is a sepreate sample download.
Re:claims != reality (Score:2)
That was a farily large, very data driven Swing app that had to run on P-90's with 32MB of memory running Win95.
Right now for a different telco I work on a production customer care site responsible for delivering performance data of network elements, trouble ticketing support, and other things on a customer facing web site. The whole thing is Java on the backend (apart from integrations into things like SecurID servers which are JNI layers). We are slowly migrating to EJB on this project, held back only by having to use Netscape Application Server and waiting for iPlanet.
I also know of many open projects at various companies desperate for Java EJB people. EJB has really gained a huge swell of support and is not any kind of fad - I personally find it hard to believe that there are that many people here not at least using servlets to some extent!
Re:Java will find a limited niche (Score:2)
- Reflection, the ability to dynamically examine type and object information at runtime.
- Dynamic class loading and custom class loaders so you can control where objects come from and load new classes without shutting the system down.
- Swing. Though it gets a bad rap here, it's really easy to customize and produce widgets that do a lot more than just sit there and look pretty. You can customize search capabilities for a combobox, or produce a table object tied right to a database for quick manipulation of data.
- JNI. You need to access some wierd hardware, a legacy system, or do something totally platform based? You have JNI, an easy and at least sort of portable way to get to native code if you really need to.
Re:Java will find a limited niche (Score:2)
When you say things like that with no supporting evidence, it only makes *you* look silly. In what way does Java reduce the degree of freedom for a programmer?
You have it exactly backwards, you know - it really frees the programmer to do interesting things. I would argue that instead of reducing your choices it offers you a great deal more.
I personally despise VB (and things of its ilk like Powerbuilder), and have developed C and C++ apps for many years. But now I prefer Java over both of these, for server side stuff as well as applications.
Re:Hasn't Java had its day? (Score:2)
Java was a great chance to make a C++ that people could understand without going through the mental contortions that currently plaugue it. At first glance it looks a lot nicer, but when you take a closer look it is just as bad, but with long keywords rather than obscure symbols. When you have classes peppered with "abstract", "final" and so on, and methods with "synchronized" etc. you start to wonder what exactly all this "synchronized final void foo()" is all about.
You get into this very fast. These modifiers are used in a consistent way, and you have public/published/protected/private in about any other OOP language as well. Final is a method that cannot be overridden, abstract is one that has to be overridden in heirs. I haven't created a multithreaded app yet, so I'm not so sure about the synchronized thing
Re:Is Anybody Really Using Java? (Honestly!) (Score:2)
This means for the IBM-PC world: if you use a relatively modern system (P-II 266+) with enough RAM (64 MB+) and a 1.2+ JRE (1.3 RC-2 is out already) things should work out well. Yes, these requirements are still not matched by every system out there, but at least it is possible to use Java without waiting for that menu to pop up (I've experienced that myself some time ago).
Price: US-$ 35... (Score:2)
Re:Price: US-$ 35... (Score:2)
I found a very promising book recently only to learn that it costs US-$ 70
Hardly. (Score:2)
I know of several multimillion user sites which run their core functionality using Java Servlets. As far as I know, Amazon.com is based on Enterprise Java Beans. EJB is an ultra scalable (horizontal) technology. Applet's are kinda dumb, agreed, but server side Java rocks.
Re:Is Anybody Really Using Java? (Honestly!) (Score:2)
At the Internet startup that I work now, Java is also the language of choice. We are moving away from all Microsoft products. Of course we are a little concerned over Sun's grip on Java right now, but I strongly believe it will be standardized by IBM without Sun. Once standardized we will move to "standard Java" and away from any proprietary form.
To me, it's not so much it integration with web-stuff, but how easy it is to write large, complex, ever-evolving programs. As most of us probably know, the requirements for our projects are constantly changing. I find Java easy to re-use and easy to change/modify. I programmed C++ for 10 years and never felt comfortable with exceptions, re-usable code, and GUI APIs. Java is good at all those.
Your point regarding the speed of Java is an excellent point, but there are many ways to optimize java. For example, when writing a GUI app you always dedicate one thread to handling user actions and spawn worker threads to perform the behind-the-scenes work, right?
That's my opinion, YMMV.
-tim
Re:Swing - Good idea, badly implemented (Score:2)
Re:Java will find a limited niche (Score:2)
C is a crap language, I used it for years, I wrote Radar Display lists in it, I wrote X Server modifications, but fundametally its a poor project language. Its debug cycle is a nightmare on large scale projects. It works in Open Source thanks to the "many eyes" philosophy.
For myself the enterprise is an application with 000s of concurrent users and a lifecycle of around 10 years "active" (normally means 20). VB is not appropriate for that sort of enviroment as it does not guide the developer towards the sort design methodologies that save time on large scale projects.
Many people look down on Java as they see OO et al as an abomination. You can hack in C better than in Java, but you can code in a team better in Java.
So far with Java I've done servlets, client server, database, MQ, legacy et al et al et al. Pure Java does work, but it still requires a skillful designer. It isn't a silver bullet, but its better than #include.
Re:Book Available Online! (Score:2)
<META NAME="Generator" CONTENT="Microsoft Word 97">
And the table tags are so broken that Netscape Communicator 4.7/NT won't even render it. You have to use Exploder.
It sounds like a nice book, but it's like the saying: if you like sausage, don't ask how it's made.
--
Re:Java will find a limited niche (Score:2)
We aren't, so I'll stick to my premise that in any market for software (even internal), performance always wins.
My personal experience certainly doesn't support your claim. I'd say that in most cases, it is the functionality that wins. It doesn't matter if the thing works slightly slower today, just as long as it works! And just as long as it doesn't bring down the application or machine that's running it.
Functionality is the key. Java can bring a lot of functionality in a quite short development time and most of the time quite safely (in other words, no dangling pointers that crash the application.. exceptions still get there and can, and sometimes do, cause trouble but they can all be caught, logged and debugged with a lot less effort than random pointer bugs).
It's quite rare that I've seen performance being the first thing required... on the top of my head I can only think of one compiler project that was running on some old VAX machines as a batch during the night and had to squeeze every bit of performance out of those trusty work horses. Other than that, it has always been about functionality.
A quick look at the API collection that Java offers reveals why it is a winner.
Re:Hasn't Java had its day? (Score:2)
I beleive the reverse is true (after 2 years of using Java after C). This is my version of history:
In ye olde time, Sun produced Java, and saith " run things over the web. Cools Toys!".
And the people jumped for joy and enjoyed pointless applets for a time.
And so saith Sun "And now you can use it for writing all your applications - and have them run anywhere"
And the people trieth, and soon realised that Java was not up to the job, and so the people began to bitch and whine and saith that Java was sh*te
That was then, and this is now:
*Java is big. Expect 2x-3x memory usage over native code.
*Java is fast. *If you have the memory*. On win/solaris/linux, Java is really usable. The two caveats are a) you need the memory, and b) Swing is still slow, but not half as bad as it used to be. We have gotten Java scientific code running to within 5% of FORTRAN.
I use a Java program every day - in preference to numerous (native) alternatives. This is Borland JBuilder - so Java is certainly a usable platform these days for a "real world application".
Don't be put off by Java's history of underperformance, and Suns dodgy claims about world domination. If you're thinking of doing anything cross platform, Java is worth a good hard look.
IMHO,
Mike.
Java won't ever replace C++ for me until (Score:2)
I'm actually quite worried that since Sun essentially 'controls' everything, noone else can make extensions that become popular enough to become part of major IDEs. (IDEs with intellisense rocks).
Here's what java needs.
1) Compile once run anywhere is not as important for where java is heading (server end). Please stop insulting us, and give us a native compiler sun. We are capable of compiling to bytecode when we want to use applets on webpages (noone does that anymore tho
Don't sun realise a lot of people don't like java cause of how bloated and slow it is?
I can live with compile once run anywhere, but for speed's sake, let us have the option of write once run anywhere.
2) Give me paramterised types or templates. Writing our own collection classes and/or casting really really sucks.
Some of the stuff that the folks who wrote Pizza [unisa.edu.au] are cool, anonymous functions for java
3) Delegates, I want MS 'delegate' style function pointers in java. Anonymous Inner Classes are horrific, and spoil Swing.
4) ASSERT. We need asserts!!!! Lucky J++ has a simple preprocessor. So many bugs could be caught if people used ASSERT more, Sun don't even think we need them!
Anyway, until at all of these relatively small additions are made, C++ is going to rule supreme.
At least for me
Re:Java will find a limited niche (Score:2)
But all other things will NOT be equal...Java's main advantage (and the reason we use it more and more each day) is development time. We have built a major client/server system from the ground up (inclucing complex business analysis) in less than 3 months, with a team of 4 developers. In C/C++ we'd still be tracking down memory leaks for the next 6 months.
Java is NOT good for everything, performance is not optimal by any means (and Swing in particular needs a decent box to run well) but the JVM's are getting better rapidly, and for large scale server based apps it is fantastic. Take a look around - most of the big blue chip financial firms I deal with are switching to Java for much if not all of their internal development. These people have big budgets and some of the best developers/analysts around, and they love Java. Good enough for me...
Re:claims != reality .. (Score:2)
Fully clusterable, fault tolerant Application Server / Web server. Written in Java.
We designed our entire backend around it, thousands of users and it is extremely stable and has allowed us very fast development.
I program in C++, C and Java. Most of my work is C++. I have found Java is a better language to program in, it forces you to have better programming style.
Code that took me 4 weeks when using C++ takes me 2 weeks in Java and it is likely to have less bugs due to memory allocation problems etc..
We have also found that anyone that is pretty new to programming can pick up Java and become a useful programmer in 1/5 of the time it would take if they were using C++ or C.
Re:claims != reality (Score:2)
Headline News From Around The Industry April 11, 2000
Informative Graphics aims to make Java visualization tool standard front-end to Documentum
Documentum
(PR Newswire: April 11, 2000, 08:04 AM)
SilverStream to bundle Java e-business integrattion technology with application server suite
Cerebellum Software,Inc., and SilverStream Software, Inc., , today announced at the SilverSummit 2000 User's Conference that the Cerebellum(TM) Internet data integration product will be bu...
(PR Newswire: April 11, 2000, 08:03 AM)
Netcom Systems brings Java-based security to Cisco Security Associate program
CA-WORLD 2000 --NetCom Systems netForensics v1.2 has received validation from Cisco Systems, Inc. to become part of the Cisco Security Associate program. NetCom's netForensics(TM) , end-...
(PR Newswire: April 11, 2000, 08:03 AM)
BravePoint to resell and implement Cerebellum Java e-business integration technology
Cerebellum Software, Inc., whichdevelops the Cerebellum(TM) Internet data integration technology for linking e-business applications with corporate data systems, today announced an agreemen...
(PR Newswire: April 11, 2000, 08:03 AM)
Oracle8i adoption reaches 17,000 customers, 500,000 downloads
Oracle Corp. , the largest provider of software for e-business, today announced that since March 1999 more than 17,000 companies have purchased Oracle8i(TM), making it the fastest growin...
(PR Newswire: April 11, 2000, 08:02 AM)
RSA Security ads Java PKI to product lineup
Highlighting this week's inaugural RSA Conference 2000 Europe, RSA Security Inc. , the most trusted name in e-security, today unveiled an easier, faster and safer way to create Java-based PK...
(PR Newswire: April 11, 2000, 08:02 AM)
Merinta basks in limelight of Virgin Magastores Java Net appliance launch
Merinta, Inc., a subsidiary ofBoundless Corporation , announced today that its first customer, Internet Appliance Network began rollout of the first 10,000 Webplayer(TM) Internet Applian...
(PR Newswire: April 11, 2000, 08:01 AM)
QuickVideo for Linux shines with Java Media Framework
LAS VEGAS, Apr 11, 2000 - InfoValue Computing Inc. unveiled the industry's first complete, end-to-end video streaming solution for Linux workstations at NAB this week in Las Vegas....
(Business Wire: April 11, 2000, 06:45 AM)
Silverstream Software Licenses Sun's Java 2 Platform, Enterprise Edition-J2ee-
WASHINGTON, Apr 10, 2000 - SilverStream eBusiness Platform Based on J2EE Standard SilverStream Software, Inc. , The eBusiness Platform Company, today announced a strategic alliance...
(Business Wire: April 10, 2000, 09:21 AM)
Passcall And Jacada Partner to Deliver Enterprise
Re:Java in Industry. (Score:2)
Re:What's the frequency? (Score:2)
Java is an amazingly easy language and has great in support with the online API [sun.com] and the online tutorial [sun.com] that explain every aspect of the language. Last fall, I had no prior knowledge of Java and was an intermediate C++ programmer. With the above links as my primary guides I am now an excellent Java developer.
In fact, at the start of my spring break I wanted to create an online survey with the data stored in an Oracle database. With no prior knowledge of JDBC or servlets I created my survey [25hoursaday.com] within 3 days (most of which was spent configuring, java web servlet engines & battling the fact that Oracle doesn't support jdk 1.2).
My point is this, languages change and mature all the time. C today is not C of 20 years ago. C++ has changed enough in the last decade that a large number of developers in industry are mystified by several aspects of the language (STL? exception handling? namespaces?). Java is a mere 5 years old and to believe the language will not evolve further before stabilizing is wishful thinking. But at least in Java's case clicking a few webpages on Sun's webpage bring you up to speed rapidly.
PS: The MSCE crack is not a flame but a genuine question. I have noticed that MSCE's unlike computer science majors believe that once one learns something that's all they have to know. I guess it comes from getting certification after taking a few exams while CS majors usually use several languages in school and also since they spend 4 years in school usually see how languages change/mature before they get into the real world.
PPS: You actually have Swing as an item in your resume? Interesting.
Re:What's the frequency? (Score:2)
Yes, well you could do the same thing in VB in probably half the time, and it would run 10 times faster.
Next time click the links before answering...
Java web pages serve faster than anything script based except mod_perl because they are memory resident via the Virtual Machine while CGi has to be read from disk. So the 10 times faster crack is simply bullshit. Secondly why did you assume I meant I was using Windows?
Aight, gotta go to class, later.
Java UML drawing app (Score:2)
Argo/UML is open source (Score:2)
-ryan
"Any way you look at it, all the information that a person accumulates in a lifetime is just a drop in the bucket."
Another big book (Score:2)
I tried Swing once, but discovered it was both slow and not yet widely deployed in browsers. But that was six months ago. Have things improved?
Re:Hasn't Java had its day? (Score:2)
Today if you want to make your web service scalable and accessible by thousands and later by millions of customers your solutions can not be implemented as CGI.
To do heavy enterprise work n-tier solutions must be used. Enterprise Java Beans (EJB) for example used by Amazon (BEA Weblogic EJB server)
EJB servers allow scalability, session and transaction control, load balancing application management etc.
The era of CGI's was great, but CGI can not satisfy massive increase of usage.
Re:Is Anybody Really Using Java? (Honestly!) (Score:2)
Re:claims != reality (Score:3)
Its popular Developer tool also deploys all of its former platform-specific client-server apps to the web via Java with a recompile, and that's got lots of customers using it.
Fact is, Java is widely used for applications staged in corporate intranets. Just because you aren't using applets as you troll sites like Slashdot doesn't mean you have any grasp on "reality".
Re:Hasn't Java had its day? (Score:3)
Umm, websites that use Java, thats a tough one, after all CGI is such a scalable tool... http://java.sun.com long shot that one... http://www.clip2.com/ is another one, and the list goes on.
Java is far from a dead language but many people see it as being it or CGI. It isn't Java is an _application_ language. Projects I have worked on have tended to have very thin client sides with Java running on a big piece of iron out back.
Java is far from dead, HTTP and Web-browsers however are a very poor means of communication and IMO will probably die in the next few years.
For cool toys in Java go to http://www.alphaworks.ibm.com
In summary Java is a commercial application language that makes it simpler (its no silver bullet mind) to develop larger scale projects and deploy in a number of enviroments.
Java in Industry. (Score:3)
Off the top of my head, let me see Mail.com uses Java to serve its pages [netcraft.com]. Does Oracle's new Enterprise database [oracle.com] count?
And from Sun's page of industry news, we have companies like RSA, Oracle, Netcom, SAAB, Delta Air etc. using Java in mission critical situations on a daily basis. [sun.com]
Posts like this make me wonder about who composes slashdot's readership. Because only script kiddies and so-called web developers (HTML and javascript kiddies) use Java as a web app language. Also no one in his right mind uses Java for GUI development if the application has any degree of complexity. But as a middleware development language it is practically untouchable. When it comes to speed of development, maintainability and expandability for business applications few things beat Java. Add a native GUI or web interface depending on your application and a rock solid app has been created.
PS: Myth dispel mode Oh yeah, by the way Java pages are faster or at the very least as fast as CGI, it has to do with being memory resident a la the VM as opposed to being read from disk. Here's a benchmark [mindcraft.com] and a link [aspect.com.au] or two [scu.edu.au].
Re:Hasn't Java had its day? (Score:3)
I would even consider using it and what the hell. Learning this is NOT so bad actually, all of the concepts play with C++ ways of thinking so well.. so you are maybe at a loss of a couple of months of good studying at worst if you learn this. I know that is a lot of time for some.. But I dont think its gonna 'crash' and burn on a resume.
The thinking is much like C++ and If you aren an OO guy aching for a decent RAD language that has reasonable sane syntax and all the fun reusability of OO Java is it, and java is backed by a big company, there is even a microsoft product for it. Java was a LOT of hype, now that its calmed down I am seeing it does have a place and I happen to like this place
I dont know how much most people have noticed but lots and lots of VB shops (one I contract for included) are turning to Java just for windows platform because its a lot more sane than VB. This is kind of cool since it means these apps can migrate to Linux nearly painlessly.. Fight it all we want business is a factor in the computer industry and many application shops are looking to Java for a solution. Best to not get caught with yer pants down
Jeremy
Re:Is Anybody Really Using Java? (Honestly!) (Score:3)
I believe Java is used on the server side more than ever before. I see multiple ecommerce services thriving upon EJB technology.
Swing is of-course used on the client side but not heavily at all. It's mostly the control app's, custom made applications for companys' intranets. Whenever you want more control over your basic DHTML capable browser and if you must satisfy multiple browsers you use Java. The $100 question is are there that many browsers that are not IE out there (except for Linux/Unix/Mac users of-course) Well, Netscape has seing constant decline in PC world, that's just too bad. Opera or c-monkey browsers and other clones are invisible to the public so majority controls are built for Windows. This does not mean that Java is not used because it's bad it means that Java is not provided by those services that only target PC systems.
Book Available Online! (Score:5)
Available in HTML and (gasp!) Word format...