Thursday, September 29, 2005

When all you have is a hammer....

Everything looks like a nail.

Some things just work better as a traditional app, guys.

Wednesday, September 28, 2005

Why friends don't let friends do J2EE

Michael Sica wrote a post about his experience writing a project manager.

Java, cool I get it. JSP, there's like 3 different ways to do everything. Which do I learn. Application frameworks, started learning Struts - what a nightmare. Stared learning JSF - what a nightmare. Found Spring and Spring MVC, and they rocked. Crap, I need to learn Tiles too. Ok, so how does Tiles work with Spring MVC. Ok that's, cool. I only need to do 6 things everytime I make a form. (I actually have a list printed out so I won't forget all the steps.)

Life's too short. Choose to be productive. Choose Python.

Tuesday, September 27, 2005

Python at Mozy.com

At my day job, I write code for a company called Berkeley Data Systems. (They found me through this blog, actually. It's been a good place to work.)

Our first product is free online backup at mozy.com. Our second beta release was yesterday; the obvious problems have been fixed, so I feel reasonably good about blogging about it.

Our back end, which is the most algorithmically complex part -- as opposed to fighting-Microsoft-APIs complex, as we have to in our desktop client -- is 90% in python with one C extension for speed. We (well, they, since I wasn't at the company at that point) initially chose Python for speed of development, and it's definitely fulfilled that expectation.

(It's also lived up to its reputation for readability, in that the Python code has had 3 different developers -- in serial -- with very quick ramp-ups in each case. Python's succinctness and and one-obvious-way-to-do-it philosophy played a big part in this.)

If you try it out, please note that after the beta period (my guess: at least a month) the "price" for mozy is that every so often we'll send you advertisements by email. (But we'll never sell your address to anyone else, and we promise not to allow any body-part-enlargement crap.) We recognize that some potential users may be turned off by this, and we will probably offer for-pay options in the future, but I don't have a time frame on when that might be.

Saturday, September 17, 2005

PyOgre

Makes me wish I had time to work on a 3D game.

An OpenLazlo blog

I'm sure being described as "an openlazlo blogger" is probably not what he had in mind, but Michael Sica of Ataraxis Software has written more about it than I've seen anywhere else. Here's his first post on the subject, from July. Around a half dozen more follow.

OpenLazlo, you will recall, is a rich web app platform that uses Jython internally. (Warning: PDF.)

(Michael's blog is also interestiing from an entrepreneurial standpoint. Starting your own company is a common fantasy for developers, and Michael is doing it. I'm catching up on the archives now.)

Tuesday, September 13, 2005

how well do you know python, part 9

(Today's questions are very CPython-specific, but that hasn't stopped me before. :)

I spent some time today looking for the source of a bug that caused my program to leak memory. A C module ultimately proved to be at fault; before figuring that out, though, I suspected that something was hanging on to data read over a socket longer than it should. I decided to check this by summing the length of all string objects:

>>> import gc
>>> sum([len(o) for o in gc.get_objects() if isinstance(o, str)])
0

No string objects? Can't be. Let's try this:

>>> a = 'asdfjkl;'
>>> len([o for o in gc.get_objects() if isinstance(o, str)])
0

So:

  1. (Easy) Why don't string objects show up for get_objects()?
  2. (Harder) How can you get a list of live string objects in the interpreter?

Friday, September 09, 2005

A review of 6 Python IDEs

(March 2006: you may also be interested the updated review I did for PyCon -- http://spyced.blogspot.com/2006/02/pycon-python-ide-review.html.)

For September's meeting, the Utah Python User Group hosted an IDE shootout. 5 presenters reviewed 6 IDEs:

(The windows version was tested for all but Eric3, which was tested on Linux. Eric3 is based on Qt, which basically means you can't run it on Windows unless you've shelled out $$$ for a commerical Qt license, since there is no GPL version of Qt for Windows. Yes, there's Qt Free, but that's not exactly production-ready software.)

Perhaps the most notable IDEs not included are SPE and DrPython. Alas, nobody had time to review these, but if you're looking for a free IDE perhaps you should include these in your search, because PyDev was the only one of the 3 free ones that we'd consider using. And if you aren't already familiar with Eclipse, PyDev probably isn't for you. (It's worth pointing out, though, that the personal editions of Komodo and Wing are only $30 and $35, respectively, and Wingware lets open-source projects use its IDE for free.)

This review first gives a comparison of features that I consider important, then gives some more subjective material for each IDE to indicate the flavor of our experience with it.

(The pronoun "we" in this post refers to the UPyUG, but "I" is always Jonathan Ellis.)

Editing

All reviewed editors provided basics like syntax highlighting. These features are not included in the comparison charts; no modern IDE should be without them.

PyDev Eric3 Boa Constructor BlackAdder Komodo Wing IDE
Keyboard Macros No Yes No No Yes Yes
Configurable Keybindings Yes No No No Yes Yes*
*Very weak UI; expect to do a lot of manual browsing
Tab Guides No Yes Yes No Yes Yes
Smart Indent* No No No No Yes Yes
*Knows to de-indent a level after break/return/etc. statements
Code completion Decent Useless No Vim-style* Good Excellent
*Can guess symbols already present in the current document
Call tips No Mostly broken No No Yes Yes*
*"Source Assistant" provides calltips and docs in a separate panel
"Go to definition" for python symbols No No No No No* Yes
*"Find symbol" is basically a find-in-files text search
Templates Yes Yes No No Yes Yes
Source Control Integration Eclipse* CVS** No No CVS/Perforce/SVN CVS
*CVS is standard; plugin availability varies for others
**SVN is ostensibly supported, but didn't work for us
GUI Builder No No Wx Qt Tk No
Emacs emulation* Poor No No No Poor Good
*None yet support VI(m) emulation -- sorry!

Debugger

PyDev Eric3 Boa Constructor BlackAdder Komodo Wing IDE
Conditional breakpoints No Yes No No Yes Yes
Evaluate arbitrary expressions Yes No No No Yes Yes
Debug external programs* No Yes No No Yes Yes
*E.g., a script processing a web server request

Miscellaneous

PyDev Eric3 Boa Constructor BlackAdder Komodo Wing IDE
Documentation Virtually none Virtually none Virtually none Poor Excellent Good
Unique features PyLint integration; "extract method" refactoring ?* Regular expression builder ?* Multilanguage; save macros; regular expression builder Source Assistant; scriptable with python
*I didn't notice anything worth mentioning

Impressions

PyDev

If you like Eclipse, PyDev is a decent choice (provided, of course, that you have a suitably beefy machine). If you are unfamiliar with Eclipse, good luck with the learning curve; you'll need it.

PyDev is the only IDE reviewed where features such as code completion will not work unless you add the .py files to the PyDev project.

"Extract method" is cool, but limited. Perhaps the biggest drawback is, it doesn't know its limits and will happily perform invalid refactorings.

Code completion is the best of the free IDEs we reviewed.

Eric3

Eric3 has a lot of good features. These are overshadowed by two problems: a horribly cluttered UI, with a correspondingly painful initial experience, and the worst implementation of code completion I have ever seen.

You can choose from two kinds of code completion: completion for the stdlib, and completion for your current project. You cannot have both at once. "What the hell?" I hear you say. Yes, but it gets worse: say you decide to pick the stdlib. You write, "import os; os." and wait expectantly for the completion. You get... a list of all symbols anywhere in the stdlib! Or pretty close to it. Wow.

Calltips are a similar mess. If you write "os.path.exists(", you may get the calltip for os.path.exists, or you may get the calltip for any other exists method.

Eric3 is documented as well as the other open-source projects we looked at, which is to say, there are some screenshots and a mailing list.

Boa Constructor

Supposedly, Boa Constructor supports code completion and call tips, which you can invoke with control-space.

This didn't work for us. At all. We didn't spend too much time trying to figure out what was wrong, though, because the worst part of the experience was how amazingly unstable Boa Constructor is. (Well, "amazingly" except to anyone who has used earlier versions of BC, I guess. Apparently this isn't new with the 0.4.4 release.) It would corrupt dialogs, screw up components such that they had to be deleted and re-added, and crash to the desktop. I hadn't considered rating IDEs on MTBF before, but Boa Constructor made me think hard about it.

Oh, and if you try BC and your first component on the frame sizes to take up the entire frame once you run it -- that's normal, apparently. Just add more components and they will start behaving. Until it crashes.

BlackAdder

The only IDE here that doesn't support code folding, BlackAdder fails in more important ways as well. (Hey, I almost never bother with folding even in other IDEs.) Most glaringly, it was the only reviewed IDE that we could not get to run a test program; it complained instead about DLL import problems. Possibly this is due to us using PyQT 3.1.14 instead of 3.7, but the former is the only one available to download from TheKompany's site. (Trying to install on Linux resulted in even less success; we never did manage to get it to run.)

BlackAdder also has the uniquely annoying trialware behavior of closing itself after 10 minutes no matter what you are doing. (The description on thekompany.com, which says that saving is disabled, is incorrect -- you do get to save your work.)

Vim-style code completion is pretty weak stuff when you're competing with companies and free projects that do the real thing.

Editor doesn't obey normal conventions like double-clicking on an option to pick it and close the dialog or re-opening a file when it changes on disk.

The only documentation is a 35-page PDF, about 18 pages of which is actually reference material. The rest is taken up by installation instructions (see above for how helpful this was to us), a tutorial (fairly useful) and a guide to QT Designer. It's hard to complain about the reference material since there really aren't a whole lot of features to document, but it's still underwhelming. (No mention is made of code completion, for instance; I never would have known about it if I hadn't seen a reference in some Usenet thread.)

BlackAdder is the oldest IDE reviewed here (1.1 was released in 2003), which speaks in more than one way to its relative priority for TheKompany. I'd be embarassed to leave a product with this level of problems in my store.

Komodo

Komodo is a good IDE, but it has rough edges. Its code completion engine is prone to refusing to help out in certain files. I couldn't discern any pattern in the set of files it couldn't figure out. It also occasionally reports parse errors on valid code; this, for instance, is valid Python 2.4 (which Komodo 3.1 supports), but even in a blank file results in a parse error:

  other_space_used = sum(max(v.space_used, v.pending_space_used)
                         for (k, v) in u._machines.items()
                         if k != self.machineid)

Another one: Alt-b cannot be rebound to anything. I filed a bug report against Komodo 3.0 for this over a year ago, and it's still there in 3.1. (I also contributed to a report listing ways to make Komodo's emacs mode not suck quite so much out-of-the-box. This hasn't improved since 3.0.1, either. I guess it's fair to say I'm not very impressed with ActiveState's support system.)

Probably the biggest win for Komodo is its support for multiple languages. If you're not lucky enough to only code in Python (I am), this might be the killer feature that makes you an ActiveState customer.

Wing

Wing shares with PyDev the distinction of being the most heavyweight IDE in this review, in the sense of needing a fairly beefy CPU to remain snappy. (Two data points: on my 1.6 GHz Pentium M with 512 MB of ram, it's fine; on my 900 MHz P4 -- it's a long story -- with 512 MB, it's noticably sluggish.) This may be due to the bulk of Wing itself being written in Python.

I called out BlackAdder for having an obnoxious trial behavior, so I should probably point out that Wing has the least obnoxious trial. You don't have to enter your email address (BlackAdder/Komodo) or download and run an executable license key (Komodo); you just install the software and Wing asks if you would like it to contact wingware.com to auto-install a trial key. Slick.

Wing is the only IDE here to give you code completion for more than function and class variables; it also completes keywords, modules (in import statements), and locals. This is more useful than it sounds; once you get used to it, you won't want to go back. (For my .NET readers: Wing does Whidbey-style completion.)

Wing's Source Assistant is nice, but it's distracting to have to look at a different panel to get call tip information. Better to have both.

Wing is the most polished of the IDEs here. I suspect this is due to the Wingware developers "dogfooding," using Wing to develop Wing. There are fewer oversights and more of the small touches that indicate quality. A minor exception is that the documentation has become outdated in some places.

Let me also note that if you tried and rejected Wing 1.1 back in the day, you should give Wing 2.0 another look. I fall into that camp myself; on Windows, at least, Wing 1.1 was horribly ugly. I couldn't stand looking at it. Wing 2.0 is much, much easier on the eyes. In fact, almost all the IDEs we reviewed look pretty good. Eric3's cluttered look is the only exception.

When I've had occasion to send several questions ("How can I make enter autocomplete, as well as tab?") and suggestions to the Wing IDE mailing list, Wingware has responded promptly. ("Use control to select multiple keys in the autocomplete dialog." Okay, I guess that was a stupid question.)

Conclusion

Early last year, I bought Komodo Personal edition for $30. That's a pretty good deal, especially when you consider its support for other languages (Perl, PHP, and TCL) as well as Python. I still think Komodo Personal is a good deal, but today I would go with Wingware Personal ($35) instead, primarily on the strength of its better code completion support, "Go to definition" feature, and Source Assistant. Superior Emacs emulation (superior to just about any other non-Emacs editor I've ever used, actually; I suspect Wingware has at least one Emacs refugee) seals the deal. A few days ago, I ordered Wing IDE Professional (paid for by my boss).

If you need an integrated GUI builder, or you have an older machine, Komodo remains a good choice, although not many people these days would pick Tk as their first choice for a GUI toolkit.

Of the free choices, PyDev is the clear choice if you have Eclipse experience. If not, well, the situation isn't pretty. Perhaps you'll have better luck with one of the IDEs we didn't review here.

Addendum

ActiveState, TheKompany, and Wingware were all kind enough to donate a license for their respective IDEs to the Utah Python User Group as door prizes for the meeting where these reviews were conducted. (None of the reviewers received any of these.) We thank these companies for their support. (Sept 22: Shawn Gordon of TheKompany appears to have decided not to honor his commitment here.)

Thanks also to all our reviewers. Alphabetically, these are Brent Hughes, Byron Clark, Jason Reusch, Jonathan Ellis, and Justin Wilson.

Update Sept 10: noted that Eric3's svn support didn't work for us