March 31, 2006

PythonDIR

This quick idea got flushed out from my habit of coming back again-and-again to the python module library and flipping through its pages to figure out the methods that a module supports. The code-completion feature of modern IDEs is convenient, but all the scrolling that one has to do grew somewhat tiring. Ok, this is what it looks like:

pythonDIR.JPG

You just type in the module name and all its supported methods get displayed via the dir() function. It only displays the top-most level hierarchy of the module. However, many times it is good enough; and the purpose here is to present a cheat sheet of the module.
This quickie tool requires wxPython. You need this installed to run it. Much of the code is generated from using Boa Constructor. It makes use of Python's dynamic import mechanism. You can download the 2 source files that are zipped here. Execute from the command-line by running App1.py.

March 23, 2006

Less is More

As a follow up to The tyranny of choice, certain groups in Microsoft are finally keen on the power of simplicity. The link provides a list of articles that focus on Simple UI Design. This is the opposite movement of the current prevailing belief: more is better.

Posted by Hoang at 02:30 PM | 3 Comments | Common Sense , Wonderful Links

March 21, 2006

the Passing Time

Have you ever noticed that when you are busy working on something enjoyable, time just flies away so quickly. When you are immersed in what you love, just blink and the times passes without you realizing that it has passed. People working in the sciences or engineering may see this more often since they have to wander inside their heads while at work. On any day, they would have to do a number of mental juggling or callistenics as part of their work. And given an interesting problem to think about, the hours just pass away like nothing at all. These are enjoyable moments.
time.jpg At the other end of the spectrum: do you remember when each minute passing would seem interminable? Periods of time such as:

  • waiting for a flight at an airport
  • waiting for a doctor in that empty examining room
  • waiting for the train to arrive in the tube
  • or... from that Seinfeld episode of waiting for a table at a restaurant...

We abhor these moments and just cannot wait until they are over. In fact, they are absolutely excruitiating.

These are just example of how our perception of time is all wrong. Time isn't linear as we measure it on a stop-watch or a clock. It changes depending upon the context... our context. How we feel at each moment may even affect the sense of time passing.

Posted by Hoang at 10:45 AM | 2 Comments | Common Sense

March 14, 2006

Reawaken to Happiness

There was a night during which I was having beers and evening drinks around a dinner table with some new parents. Our conversation revolved around the topic of raising kids and providing the right facilities for their eventual happiness. People talked about bathing their babies in Evian water, sending them to the best gymnastic school, piano classes, swimming classes, and even saving for their kids to go to the best colleges. Obviously the overriding theme is how to provide the best that they can for their kids. Common to every parents, the topics are very motherly and sweet. (Let me preface by saying that I don't have kids; so anything I might say on the topic will make me look like someone talking out of his ass)

grow.jpg Throughout the night, the conversation continued on about giving children more and more positive experiences. It seemed obvious that this is the right and only way to raise and teach their children about life. That they should give their kids whatever the kids want, give them those things that the parents themselves never had as a child, and give them what society and commercials say that a parent should give their kid. Despite my being the only childless person there, a nagging question keeps popping up in my head. Real life isn't just about having only good things. How about exposing them to some negative experiences? Exposing them to the raw bad experience might be too heartbreaking, but how about in a controlled environment? In helping our children grow, is it just as beneficial to expose our children to negative experiences as well as positive ones? Reflecting back in our own adult lives, without having tasted bitter, we might just not know how sweet sweet tastes. This is a good article that explores the topic in much greater detail:
Psychology Today: The Hidden Side of Happiness

In trying so hard to shield ourselves from bad experiences, could it be that we might have the idea of happiness wrong?

Posted by Hoang at 01:50 PM | 3 Comments | Common Sense , Wonderful Links

March 10, 2006

Does Python cause suffering via the Tyranny of Choice?

First of all, Tyranny of Choice is a condition of American society that psychologist Barry Schwartz has been trying to make the us aware of. It basically says that having some choices in our decision making process is good, but having too many choices cripples us. Having many choices, we are immensely pressured to not make a wrong choice. (who in their right mind wants to be the idiot making a wrong decision?) The process of making the right choice takes up so much of our time, effort, and causes a great amount of frustration. Multiply this by the number of things we have to make decisions on: what kind of pancakes for breakfast, what kind of coffee at Starbucks, what kind of dressing on the salad.... and the list goes on-and-on within the routine that is our everyday lives. It is a wonder we can ever get through our day at all.

In terms of developing computer programs with Python, there is a great benefit in that it include a large set of batteries/library to leverage your program off of. In addition, there is a plethora of 3rd party libraries that we could leverage from. This can be seen as a boon.

However, I am noticing the Tyranny effect happening. My previous difficulty in choosing a networking library is one instance. If you do GUI programming, your array of choices are: TK, wxPython, PythonCard, BOA, QT, EasyDialogs, Wax, .... and the list goes on. Someone else can probably make a list of the array of choices available for web-frameworks or even Templating.

I am going to say that this is just a general observation so that it won't invoke backlash from proponents of Python. I don't want to start a word war just because of an observation. But the pattern is there. Even the Effbot noticed: we really don't need eight ways to open the trunk.

3-17-06 . Addendum: There was a jot previously of the opposite effect in - Monopolies and software resuse. Contrary to popular thought, this is where monopolies might just be good for you.

Posted by Hoang at 11:55 AM | 14 Comments | Python Programming

March 08, 2006

Old Python Programs breaking

It has been 3 years since I have done any programming with wxPython. In order to refresh myself, I bring out an old project and try to execute it. It crashes with various Exceptions and as I fix each one, another just takes its place. In this instance, it was that wxPython was changing its interfaces fairly recently.

Let's just ignore the specifics and just notice the general behavior that python projects just seem to break over time. As much as I enjoy working with Python, again-and-again this scenario arises. Some source code even stopped working when a new Python distribution is released. Have other people experienced the same? If you have, what do you do about it? The realization of hearty efforts put into development can easily go down the drain in the pretty near future disturbs me.

Posted by Hoang at 07:48 AM | 7 Comments | Python Programming

March 03, 2006

More Readings

Software Development

  • Pragmatic Programmer: Articles, Essays, and Presentations
    I have been a fan of common sense for a while now. That is the initial purpose of this web site. As a software engineer, there is a time in your development when you move beyond the languages, operating systems, and frameworks. You find that well designed and successful systems have abstract elements in common. Object oriented programming attempts to capture this by capturing it in classes and their relationships. Design Patterns take it one step further by forgetting the implementation and just capturing the relationship and behaviors. Pragmatism or common sense just says that these are the behaviors that good and well behaved systems have in common. Hopefully other software folks can share in these nuggets of wisdom that the Pragmatic folks have revealed.

Interesting Articles for perusing