Wednesday, July 4, 2012

Documentation, Documentation, Documentation

Steve Ballmer is famous for walking around on stage chanting "Developers" over and over again. If you haven't seen it, go search YouTube. It's... interesting.

After some thinking on it I feel like chanting "Documentation" in a similar way.

Well... maybe not, but I'm coming to more fully appreciate the role of documentation.

I read this so long ago I can't be sure of where I first encountered it, so I can't give proper credit, but the argument goes that it doesn't matter how clever your code is if no one can figure out how to use it. I've personally experienced this a number of times without noticing it.

The quality of Python's documentation was a factor in my starting to favor Python over Perl around 12-13 years ago.

I liked TurboGears, but ultimately ended up using Django more. The docs were a factor.

I'm really intrigued by Flask, largely because the docs are not only informative on Flask itself but also contain some good advice on web development in general.

I've encountered this a number of other times and often just taken what seemed the most natural path. It's interesting to think what a big factor docs have been.

I've long evaluated the quality of my own work based on the efficiency of the code, the size of a web page over the wire, the simplicity of the design... but what about documentation? But then, I make web apps, and a web app shouldn't need a manual like a development framework would (except maybe for operations/deployment), and no one needs to look at a manual for an iPhone. Sometimes a screencast is more appropriate. So maybe "approachability" is a better word.

Interestingly volume isn't what you necessarily want. I'd take a screencast over reading 5 pages any day and a short PDF over a long PDF (as long as it has what's needed). The Flask docs as a PDF weigh in at 277 pages. Compare that to Django's 1,174 page PDF. While Django does a lot more (and hats off to the team for making sure it's all documented) Flask feels more approachable. I'm looking forward to trying it out.

I've been working on a Django project for a while that has a pretty complicated set of models and a lot of customization in the admin. Some of the users of the admin are not too technical. I've been thinking that I'd like to integrate a YouTube channel of howto-style screencasts right into the admin.

Approachability is a huge factor in making something that's really great, and that's what I'm after.

Python 3 Marketing Problem?

I ran across Ted Dziuba's excellent post about Python 3's marketing problem via Reddit:
http://teddziuba.com/post/26426290981/python-3s-marketing-problem

I find his argument somewhat convincing. While I like the multiprocessing module there are times when you just need proper threads. An example: if one of your Python processes is starting other child processes, how can you pass the handle to another Python process and let it read input? I don't think you can (please tell me I'm wrong). Also, Peter Wang commented on Ted's blog that rich client apps can benefit from good threading.

I read the link on Python 3 Q&A which Ted provided: http://ncoghlan_devs-python-notes.readthedocs.org/en/latest/python3/questions_and_answers.html (by Nick Coghlan).

I found 2 things interesting about this.


First, I found it reassuring that it was anticipated that the switch to Python 3 would take this long.

Going in to this process, my personal estimate was that it would take roughly 5 years to get from the first production ready release of Python 3 to the point where its ecosystem would be sufficiently mature for it to be recommended unreservedly for all new Python projects  
. . . . 
If we haven’t put this largely behind us by the end of June, 2014, I’ll be disappointed.
It's just his personal opinion, but Nick is closer to the matter than myself, so it's an interesting data point.

Second, the mention of the work on STM for PyPy. I've toyed with PyPy a very little bit and it's probably the first thing I'd reach for if I had a performance issue with Python. That PyPy may also address the GIL/threading issue is really exciting. I'll be watching this space.

It's an interesting thought, but I'm not sure I agree that learning Python 3 is as risky as learning a new language. I'll reserve judgement on that, I confess I haven't tried it yet. The libraries are starting to move over and in a couple of years the risk will certainly be lower.

Is it worth the effort to migrate to Python 3? I will say: not yet. I'm mostly waiting on Django (though if Flask gets there first...).

I'm going to watch the Python 3 library porting effort along with PyPy's STM work and re-evaluate later. Will I move away from Python if threading never gets fixed? It might be a factor, but alone it might not be enough of an issue as long as there are work arounds.


I wouldn't exactly be heartbroken if Python 3 turns out like Perl 6. Perl 6 stalled (died?) and Perl 5 revitalized in the meantime. That'd be an interesting development for Python, though I hope the Python community wouldn't dry up in the process.


Meanwhile, it looks as though Python 2 will still be viable for a long time.

Sunday, November 21, 2010

PyCharm, Charming Indeed

At my day job, I use Eclipse for writing Java. On other projects, well, it's been complicated. At home I prefer Python and Django over Java and JSF.

In the past, I've cycled between Vim, Eclipse and NetBeans.

Pydev does a great job of supporting Python in Eclipse, but Eclipse itself can be aggravating at times. Firstly, I'm using it on a Macbook, and it eats battery. Secondly, I've had mixed results setting up the mercurial plugin. It had been a while since I had tried (I seem to remember things basically working last time) but on my most recent attempt at Eclipse, I needed to sign-up for an account at javaforge.com to install the plugin. "Annoying," I thought, "but at least it's free." Well, after signing up, Eclipse wouldn't let me agree to the license. I suppose I could have kept fighting with it, but Eclipse starts to feel like paperwork if you have to work too much at configuring it (I hate paperwork). The dialogs for installing/removing/updating plug-ins don't seem like they're well thought-out.

NetBeans, has support for Mercurial that was either easy to setup or out-of-the-box (I can't remember needing to install it, but I may be wrong). I really like how NetBeans highlights uncommitted changes on the left of the editor without doing anything (no need to do a Team > Compare ... as in Eclipse). Very nice. NetBeans also has a much nicer plug-in installation process. I had an OK experience with NetBeans while dabbling with Groovy & Grails earlier this year (would have enjoyed it more if code-completion wasn't abysmally slow) and considered giving NetBeans a try for Python. Unfortunately, it seems that the project to support Python in NetBeans has stalled or died.

These experiences being par for the course, mostly I've been hacking away using Vim. I've learned to really enjoy Ctrl+N (complete word) when you've got your whole project open in buffers. Typing ":b part-of-some-filename<tab>" isn't a bad way to navigate. Setting up indent-based folds and using zM (max folds) and zR (no folds) is a workable substitute for Eclipse's outline. Battery life is fantastic, and my fingers love Vim (ddp, %s/blah/what/, :w).

Still, I missed having something underline my mistakes, having a nice outline of the code, and having side-by-side diffs like those I get with Eclipse at work (where CVS is used, hence side-stepping plug-ins).

I decided to give PyCharm a try today. I'm pretty impressed so far.

PyCharm has a "Power Save Mode", and after watching my battery life while working un-plugged for nearly an hour, it seems to work well.

CVS, Git, Mercurial and Subversion are supported out of the box. Uncommitted changes are highlighted on the left of the editor, just like NetBeans.

The editor doesn't seem to have block selection like Vim. I've yet to find a way to change the color scheme. I miss Vim's key bindings, but it's early.

Copying and pasting code from a web2py project I'm rewriting using Django gave me a little trouble. PyCharm kept nagging me to import web2py symbols that I was busy replacing with the appropriate Django equivalents. It didn't actually interrupt me, I just kept seeing this little tool-tip giving me the key-combo to do an import (useful when I've needed it, but annoying in this case). I can probably switch this off.

Overall, I'd say JetBrains has a pretty good chance of getting some money from me by the time my trial runs out.

Tuesday, September 7, 2010

Cappuccino Book on the Way

I was scanning some groups and noticed this thread on the objective-j list: http://bit.ly/c7E3wX.

Looks like the Pragmatic Programmers will be publishing a book on the Cappuccino framework! This is pretty cool. I'll have to get a copy when it comes out...