Sunday, October 15, 2006

Spilt Mind

I won't be able to use it much, but if I have the need to write something and get some creativity flowing (it helps improve your coding mind, as well), I will be posting those writings or art pieces to a new blog I created, Spilt Mind. So easy to make a new blog, and I keep getting distraught over my lack of writing and painting over the last year or two. This is a much needed outlet, however much it gets used.

Uprooting and Replanting

It looks my time doing contract work is coming to an end. I will soon be officially accepting a full-time position with a relocation to the Houston, TX area. I'll have much more to blog about as we accelerate development timetables and things begin to roll along.

I'm tired and exhausted from spending days with this on my mind, so I'm not writing much. I just wanted to ask, is anyone from the area? I see there is no User Group near Houston, at least not listed at the Wiki. Does anyone know of one or would be interested in starting one?

Any tips for long (1700 mile) moves?

Saturday, October 14, 2006

Identity Comparison vs Comparing Identities

An explaination of the virtues of foo is not None over foo != None lead to an explaination of identity comparison with the is operator. A fellow equated this to, roughly, id(a.x) == id(b.x), which I told him was roughly correct but probably not actually correct. It only took a little bit of through to see how uncorrect it was.

The following code creates a simple class with one property descriptor (read-only). It solves the requirements that with to instances of this class, a and b, id(a.x)==id(b.x) can be true while a.x is not b.x! How does this happen?

class foo(object):
x = property(lambda s: id(s))
a = foo()
b = foo()
assert id(a.x) == id(b.x)
assert a.x is not b.x

How on earth does this code prove what it does? a.x and b.x are created on the fly, passed to the id function, and then destroyed with no references left. Because they are both created in the right order with the id(a.x)==id(b.x) expression, they just happen to get the same memory addresses, which in CPython is used for the id function's result. This leads to misleading results, so don't rely on them in such ways. Identification is what it is, and you shouldn't try to break it down.

Thursday, October 12, 2006

RuPy, Snakes and Rubies, Night and Day

What is going on?

All around me I see people relating Python and Ruby. The communities seem somehow intertwined with their users, usages, and publicity. It seems like you can never find a blog that talks about one without the other, or a new frontier being tested by one of the "new" languages and not being explored by its counterpart. Where do people see this distorted similarity between two languages that are as different as night and day?

To Rubyist out there, don't take offense. I have far more experience with Python, than with Ruby, so I might sound biased. Please, take this as an honestly unbiased opinion. I'm just talking from the middle in this case.

Python stands out from most of the other languages around. Largely it is understood as "the language without brackets", but it is not entirely alone there. Ruby almost appears like a language extremist. Their core types have fifty million methods each, because if you expect it to be there, it should be there. Python is important, because it explores the methods a language can encourage good coding practices onto developers. Ruby is vital, because it explores interesting constructs like continuations and compact code forms utilizing their quirky syntaxes. Both might have their place, but they are far different places. Python is unassuming. It will take nothing for granted, such as not taking for granted that you wanted a method call, not a call to a function in some method. Ruby is assuming. It understands the difference between objects and types, just based on the casing of the name.

Fuzzyman states a similarity between the languages, but can this be taken as anything more than common usage? We can see an assumption of similarity across both communities, but nothing really ties them together anymore than any languages are connected by virtue of all being languages.

I've been known at times to seem like a Python zealot and anti-PHP/Perl/Ruby, but in this case I'm setting that aside and I want to state very clearly: these two languages are not similar. They are very different beasts, with more differences than anything else. The illusion of a relation between Ruby and Python only harms both of them. We have people asking for continuations in Python constantly, when they are a great idea in Ruby, but would not likely work well in this very different environment. Rubyist get attacked by a barrage of Rails killing Python projects, trying to take their steam.

Shouldn't we go our separate ways?

Wednesday, October 11, 2006

Balence, Tranquility, and SOAP

I am behind schedule with my work. I attribute a good bit of this to my vices as a developer, and just as much of the problem to my good attributes. I place an equal portion of the blame on SOAP.

Striving for the goal of Beautiful Code, we can find ourselves lost on the way to actually writing something that gets the job done. Throwing away perfectly working code, because an alternative way to achieve the same results is more elegant isn't something that we might see as a bad idea. If the code is more l33t now, it will give us less trouble tomorrow when we need to port it to my toaster. We'll use anything to justify the overworking for code beauty.

Is it always worth it? How beautiful is enough and when are we just wasting our time (and money)?

There are terms thrown around like "elegant" and "pythonic" to measure the quality of code with no attention to the code actually reaching the goal it sets out to perform. The code may work, but that doesn't make the code good code. Without a sense of time, scale, and the big picture, the search for good code can overshadow any good developer's work towards working code.

However, as any issue as a flip side, those developers getting lost are doing so in the name of a good fight: the first against bad code. We might get lost and never complete our code, or complete it late, but we do so with the complete belief that it was worth it. The code took several weeks longer to develop, but just look at how beautiful it is. Without the struggle for good code, our working, bad code would eventually overshadow us just as much and consume our time with maintenance, refactoring, and the mother of all frustrations in coding: trying to read your own work.

I am wrapping up some SOAP-heavy work and the path to completing it has been a testimony to the struggle of balance in code. Recent refactorings of the actual SOAP response processing ended with a good chunk of bad code. I don't like the way I'm doing lots of things, or the fact that it doesn't parse corner cases the service I'm using doesn't even use. The code is not the beautiful code I would like to call my own, but the code is working code and does everything it needs to do. I had to bite my own hand to keep the refactoring to a minimal and focus solely on the aspects of functional goals, ignoring aesthetics.

Be careful on the road to good code. Somewhere along the way, you can easily get lost and never reach the point of having actual, working product. Sure, the code will be incomplete, but it will be a fragment of beauty. Learn the value of a completed mediocre code set over the eternal development of more beautiful code, which does exactly the same thing.

Monday, October 09, 2006

You Go, Gamer!

I would consider myself a gamer. The video game industry has been a huge influence on my life from childhood to parenthood. My father was a gamer, who even owned an arcade as a younger man, before I was born. The last machines, a unremembered pinball unit and a standup Qix were the first things walking in the door of his place. I even had a two-screen, six-player TMNT Turtles in Time arcade machine, which made me the coolest kid among my friends. Yes, I am a gamer.

Today I denounce my fellow gamers, and I call out to those of you with any backbone to stand with me in decrying those among us who, basically, just make us look bad.

The subject of debate is a recent survey making statements about the percentage of females among the online gaming community. The surprising results state that 64% of online gamers are female, and the response to this news is just as surprising: outright denial. Male gamers seem completely impossible to accept that they are not the majority of gamers, while they have been simultaniously complaining about the lack of female gamers for years.

Apparently, someone forgot to include a requirement that they be "real" gamers.

Over at the popular gamer blog and online comic, My Extra Life, the story was given with a note of disbelief and the commentors followed suit. Reading through the comments, you can see such Male Stereotype Improving comments as the following samples:
  • The survey sounds fishy, unless they included "free games that are in the browser or games like second life." It still sounds fishy.
  • "No. I am a minority darn it!
    I will not play with 64% of other women!

    Maybe its a typo, maybe they meant 64% of gamers are kids.."

  • "women under 16 years of age sound like dudes"
  • "I agree.. 90% of them are playing bejeweled right now."
  • "they’re not the kinds of games correlated with the “gamer” title"
Neopets is probably one of the older and most popular online games around, and any real "gamer" will correct you if you say its a real game. It is only a kids toy. Or, a chick thing, if you find someone really intelligent.

I had my say over there, so I'll quote myself now: "I am disgusted by my fellow gamers’ responses at this announcement. I have heard nothing but denial, attacks on the survey, insults towards are female gamers, and downright insulting behavior coming from my demographic. We have to find all sorts of reasons why the survey is inaccurate, or counted things that “aren’t real games”, because we aren’t man enough to admit to not being on top of something we long thought was our own. Get a life and just admit the truth. It doesn’t matter if you play Halo or Scrabble, and its sexist and degrading to assume thats the only kind of game those women would play. Degrading to other male gamers, who have to be lumped in with the deplorable comments being made around here.

Of course more women would play online games! Lots of women love to game, but its not like they can play among other gamers face-to-face. When’s the last time you treated your buddy’s girlfriend as an equal in a game of Halo? No, she goes on as a handicap. No one takes her seriously. So, what is so to do to satisfy the thirst for games? Play online, where no one even realizes she has breasts. That’s why 64% of online gamers are women: because you don’t know and you hunt them down in Counter-Strike just as ruthlessly as anyone else."

One of my best friends is more of a gamer than I can claim to be. I just can't justify spending as much on games as he does, and my buddy has three times as many kids as me. His wife can't hold her own against the worst of us on the old Halo nights (which I miss so much), but she could kick my butt in a game of online poker or a few rounds of guitar hero.

Besides all the response making me ashamed of my fellow male gamers and wishing I could avoid the association until this blows over, I found the comment about Second Life to be pretty confusing. I understand why you don't consider a Scrabble game on Yahoo to be a "real game", even though I don't agree, but Second Life is one the greatest acheivements in gaming history. What gives, traveller18?

Ironically, when I sought out some stock photos for this post, over at stock.xchng, I turned up both of those photos of girls gaming, but not a single one of a male gamer.

Sunday, October 08, 2006

Movable IDLE: Keep it Free, Fuzzyman!


Several weeks ago, I contacted Michael Foord (aka, Fuzzyman) about the idea of a simpler, slimmed version of his Movable Python distribution for those interested in the language, and often not computer literate enough to put up with all the different components you need for any decent development environment. This is exactly what we need to convince those people still hanging on to BASIC.

I don't know if its from my suggestion, although I got a personal e-mail from Fuzzy on the announcement, but its here and its free and its exactly what I need for the many interested people I am trying to bring Python to.

Google Reader Upgrade Dissappoints


Yet again, I find myself wishing I could say I like what Google has done with something, only to be forced into admitting: they disappoint me. Well, add one more to the list of things Google can't get right, even with an army of PhD holders and more money than you can shake a redwood forest at: Google Reader has gone from simple gold to contorted crap. The original version was a great excersize in simplicity in design that let me jump in, read, and get on with my life. The "upgrade" is a mess of a noisy interface for me to get lost in as my browser slows to a crawl with far more JavaScript than a simple reader needs, and even the occassional forgetting of everything I haven't read yet.

I was a little late in the Blogscene, which is a relative statement given that most of the world doesn't know what a blog is, despite the fact that most bloggers think otherwise. I started with my trusty KDE's Akregator, which is admirably usable, and then looked for a web-solution to use better from multiple boxes and a laptop, right around the time the first Google Reader was released. I jumped on board, and I loved it. Right off the bat you have your entire reading queue, waiting for you to read through one post at a time. Read, hit the j button, read, j, read, j, j (I skip things, a lot), j, j, j, read, j, read. If I had a backlog, I could just pick labels or subscriptions to read first and be on my way until I had time to read less important things. The key is it was simple. Most of the time, I only ever used a single button: the j. It was fast, showing just what I was reading and a few things coming up on the list. Thanks to (possibly accidental) details of the implementation, I could scrollwheel over the reading list and pre-load hundreds of articles, so that I could read them offline in my web-based reader! Again, best of all, it was simple. It did all this and it was clean, and simple. God, it was simple.

The new Reader is a beast. There is a busy tree of labels and subscriptions listed on the left, repeating my feeds for every label they are in. The unread counts are always inaccurate. It tries to show me everything I've read so far on the page, which adds up quickly. I can't mark anything as read without everything before it getting marked too, which means no holding things to read later. The javascript slows the page down and even locks up FireFox for a few moments when loading the next posts. it is not simple.

Google, use your many brains. I don't know how you could have messed this up so badly. It brings up an interesting question: is it OK to compete with yourself? They say that the new Reader meets the middle-ground between what everyone wants, but does that mean it doesnt actually fit what any one person wants? Re-release the original as Google Quick Reader or something.

I'm sorry. This post was badly written. Call it a rant. I just miss my reader.

Friday, October 06, 2006

Stuff of Interest - Week of Sept 17 - 23, 2006

Wow! It has been almost two weeks since my last post, and I was doing so well. Unfortunately, i got quite sick and then had an unexpected trip out of state (read: I forgot about it until the day before!) and now feel ill, yet again. But, determination brings me back. I was planning to post this on the 23rd of September, but the 6th of October is close enough. Regular posting will continue starting tomorrow.




This is the first in my weekly post of interesting links around the web. These are articles, websites, services, photos, and anything that else that I want to bring up on my blog, but can't use an entire post for. Being on any aggregation sites makes you think harder on each post and puts some weight on you against those little posts, at least in my mind.

Hopefully, you'll enjoy whatever I post here. Maybe you'll find a useful site, or learn something you wouldn't otherwise.

Really Smart Stuff

Ross Jekel, over on the Python 3000 mailing list, supported the existance of the GIL (Global Interpreter Lock) in a very clear paragraph). This came from a thread (yet again) about the possible removal of the GIL for Python 3.0, which will almost definately not happen. Instead, the most weight seems to be toward improving the effectiveness and productivity of multi-process or multi-interpreter-in-one-process communication to offset call between interpreter boundries. Awesome stuff if it happens!
After some initial surprise when I learned about it, I'm now okay with a GIL or even single threaded python (with async I/O if necessary). In my opinion threaded programs with one big shared data space (like CPython's) are fundamentally untestable and unverifiable, and the GIL was the best solution to reduce risk in that area. I am happy the GIL exists because it forces me to come up designs for programs and systems that are easier to write, more predictable both in terms of correctness and performance, and easier to maintain and scale. I think there would be significant backlash in the Python development community the first time an intermittent race condition or a deadlock occurs in the CPython interpretor after years of relying on it as a predictable, reliable platform.

Really Cool Stuff

In my effort to professionalize my blog, snazzy it up a little, and a general interest in having cool things to look at, I found stock.xchang, a free stock photo exchange website. There are great photos available there, and when I get my camera working again, I will definately be contributing to the collection.

Sometimes you just gotta say "Wow." I had a little trouble with the prototype applet running sluggish and buggy, but watching the demo video is just amazing. The software will extract 2D shapes into 3D models and allow you to extrude, cut, reshape, and just do some amazing things with an interface so simple that a kid could, and has, use it. Makes me want a touchscreen all the more, so I can have extra fun playing with this.

Really Quick Stuff

JavaScript Scope (and this) Explained in Detail
ParenScript - Lisp to JavaScript translator

Being Helpful by Not Answering Questions

As some of my readers (I have readers?) may know, I am a frequent of #python over at Freenode. A great place. One of the most supportive IRC channels I have ever been a member of. Over the years I have been a frequent member of this channel, I have received an awful lot of help. It is where I went when I first decided to learn Python, and the kind folks there did great things to guide me along. I learned and I stayed, because I still need some good minds to knock ideas around with, and figure things out. I also stayed because the best way I can repay the help I received is to return it to others who seek just that.

I want to think my help is appreciated. I happen to know it is. There is an increasing number of regulars, learning their way through, who explicitly seek me for help, send me entire projects to look over, and generally befriend me in response to the advice I give them. I try not to think highly of myself, but I do believe I am valuable to that channel and that many others would agree.

A few, however, seem to hate my guts. A growing minority of users are continually harassing me over my methods of giving advice. They have a problem with how I talk to people that ask simple questions, even with those people not being them and happily taking my advice over the complaints of these few difficult IRC'ers. What they seem to have a problem with is my tendency to answer questions with questions, investigate why someone thinks they want to do what they ask how to do, and suggesting other ways to reach their goals that may be better than what they came seeking.

This is not a technique of myself alone. Python has a strong community of developers with strong opinions. It is not unusual for people to ask about threads and be told that Twisted, separated processes, or Stackless is better. If someone asks how to set a variable with a name in some string, they aren't told about globals() and locals(), but to use a dictionary instead, and usually will be given a small talk about how all variables exist in dictionary, including the globals and locals, so there is no overhead in this and its a perfectly good thing to do.

People aren't given a gun to shoot themselves with. They are given advice not in answering their question directly, but delving into the source of the question and solving the problems that lead to their asking a question, although sometimes misconceived.

Is it wrong to assume you know someone shouldn't do what they ask how to do, and tell them something else instead? Does anyone have the right to insult and verbally abuse those who practice such techniques of helping others?

Does anyone have thoughts on this? Lending a hand is important, so we should be doing it right.
I write here about programming, how to program better, things I think are neat and are related to programming. I might write other things at my personal website.

I am happily employed by the excellent Caktus Group, located in beautiful and friendly Carrboro, NC, where I work with Python, Django, and Javascript.

Blog Archive