I know there've already been a couple responses on this. I've been meaning to reply, but been preoccupied. But I found this post very interesting, and am wondering if more discussion might be in order.
Bob Noonan wrote: > Toby Donaldsoon writes: > > >>I've been involved with teaching CS1/CS2 style courses for the last couple >>of years where Python is used in the first course, and Java in the second. >>It's a good combination. > > >>Simple Python programs are usually much easier to read and simpler to write >>than simple Java programs, and so students new to programming really like >>it. > > > I would love to switch our CS1 course to Python. It seems like I am always > about 5-8 years ahead of my department. After starting in 1997, it took me > until 2003 to get our CS1 course switched from C++ to Java. > > At the time we did it, I knew Python was a better choice, precisely because: > > 1. It is a good scripting language. > > 2. 50% of our CS1 students never take another CS course; clearly, these > students are better off with Python than with Java. > > The one place where Python is clearly deficient IMHO is in GUI programming. > Tkinter (and the TK toolkit) are nowhere near the quality and simplicity of > Swing. Pack as a layout manager is difficult, at best. And yes, I am aware > of other GUI interfaces such as wxPython, but the infrastructure is not there > to support them. All of the Python textbooks that I am familiar with cover > only Tkinter. > I realize that GUI toolkits are probably more a matter of taste and experience more than any other component of development. But, I wonder if you could explain to me in what ways you see Swing as simpler than TKinter? Tkinter is by far the simplest GUI toolkit I've ever worked with (including: Xlib, Tkinter, Swing, Java AWT, GTK, wxPython, and Qt). You can get everything you need to know to start working with Tk in about a 25 page summary. Swing requires a couple hundred pages minimum in my experience. I've given software engineering classes a quick rundown on Tk in one or two lectures and then let them go their own way. In Swing, I taught a 1.5 credit hour class over an entire semester, and they still didn't really get to the point of being able to write interesting programs. In terms of quality, TK does have some deficiencies (limited widget set, somewhat old-fashioned look and quirky behavior across patforms). As such, I consider Tkinter a great tool for easy prototyping, but not necessarily so good for finished products. On the other hand, it has been used for some very impressive apps. I would not consider the packer to be a deficiency. In TK, you can learn this one (relatively) simple geometry manager and do pretty much anything you want. In Swing, you have to learn a bunch of layout managers to do anything remotely sophisticated, and if you're talking difficult, the Swing gridbag is far more unwieldly than the Tk packer. Plus, Tk also offers the gridder and placer geometry managers, if you really want something other than packer. I know I am not alone in feeling that Swing is one place where Java has really failed miserably. It is a complex, bloated framework that (often) produces slow, cumbersome, memory intensive, and ugly interfaces (can you get anti-aliased fonts in swing?). IBM ditched Swing and built it's own toolkit for developing Eclipse. I suspect more and more developers will look that direction. The absolute beauty of Python is the "embarrassment of riches" when it comes to high-quality GUI toolkits. Whatever style framework you like, you can use it in Python. As someone already mentioned, if you like Swing, then use it in Python through Jython (that's about the only way I can tolerate Swing, myself). Tkinter is a great choice for simple GUIs and learning basic GUI principles. Wx offers a nice cross platform solution that is extremely well supported for Python. Lots of folks swear by GTK and Glade. I am personally very impressed with PyQt, and think it is well worth a look if you want to do industrial-strength GUIs with a modern, well-deisgned, cross-platform framework. There's at least one book covering Python with QT, and it's very easy to translate the excellent C++ documentation directly into working Python code. In summary, Python seems a much more GUI-friendly language than Java, so I don't think that should stand in the way of its use in intro programming classes. If I had to teach GUIs early on, I would definitely choose Tkinter over Swing. Of course, whether GUI programming is an important topic for intro classes is a whole different matter... -- John M. Zelle, Ph.D. Wartburg College Professor of Computer Science Waverly, IA [EMAIL PROTECTED] (319) 352-8360 _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
