Wednesday, May 04, 2005

Python In The Office

I’ve been finding ways to make my life easier, more interesting and generally more efficient.

Ok… that’s just an excuse to introduce my lattest work plaything… Python.



If you know me at all, you’ll know that I would love to work daily with Python, but I work in a C#/.NET outsourcing, so it’s sort of impossible right? I mean since IronPython is still in early alpha, there’s nothing I can actually do about that, right?



Well, I’d not been really using my brain earlier. Now that I am actually turning on my brain full force, by aggressively getting lazy about repetitive tasks in any incarnation, I’ve began to really see uses of Python all around what I do almost on a daily basis.



It started with writing libpm, which is a Python library to interface with a Webservice which we use to do some reporting at work. Well, my next focus was some really dreary analyses I’ve been doing on a database project. I run some huge queries, and produce files and I’m supposed to compare for accuracy and other stuff. Well, when I’m troubleshooting, I get to do a lot of other fancy stuff to those files, and I’d been doing all these visually all this while!!!



Last week, I had to get back to the project, as it has over-dragged behind other projects, and for the analyses, I said NO NO NO, I’m not doing this visually again. I mean, its not even efficient enough, so I dug up Python and started building up small functions and small programs. As a result of that I now have a little module called ‘kamba’ that does some really interesting text processing. The most exiting is a function align, that if given two lists in the form of:



[1,2,3,4,5,6,7,8,9,10,11]

[1,3,5,6,9,10]



Will return a third list which aligns the second one against the first one, like:



[1, ,3, ,5,6, , ,9,10, ]



This single functionality is a realllll time shaver :D, and combined with other stuff has helped me get more usefull results in my analyses.



I think I’ve discovered in doing this, that hackability of a platform depends on a lot of factors, but most importantly are the tools available and the mindset of the said hacker.



I really am not thrilled by Windows generally, but hey, Python on Windows is helping me get some of the fun I normally catch on UNIX.



The second thing is that flexible tools affect mindset. For instance, If I didn’t have Python available to me, there is no way I would have written those tools in a language like C# or similar. Why? Well… there’s a lot of inherent overhead in setting up the project, and just thinking thru annoying issues like type definitions and other things that are not directly related to the problem you’re trying to solve.



This is not exactly a bad thing considered on its own, I mean, there’s the argument that you should use another tool to do that kind of thing. Well… this brings me to my point. My point is that a lot of programmers these days (well, at least more than I would like to think about), don’t have any kind of dynamic programming tool at their disposal, because there’s this prevalent all or nothing mindset.



Those kind of people are more apt to resist programmatic changes. They don’t think in terms of scripts and quick solutions. They’re not used to making small programs that do only one thing and do it well, or really to writing small functions that do one thing and do it well.



Basically, by sticking to and working with non-malleable programming languages their mindset is also non-malleable. These kinds of programmers find it hardest to think Agile or think in the dynamic way needed to really drive software development these days.



Ofcourse you could say this is just my opinion, and I’d agree with you, but I’ll point out that I’ve met plenty of these kinds of programmers.



My recommendation is that every programmer, should learn more than one language. And these languages should be best spread along different programming paradigms. For instance, if someone learnt to program with Java, and has now learnt C#, yeah… that’s ok… but this person has NO IDEA whatsoever of how a program can be written without classes. This programmer also is more likely to have more complex approaches to problems than others that are exposed to say C, Ruby, Python, Perl, and shell scripting.



Anyways…. Work is currently more interesting.

0 Comments:

Post a Comment

<< Home