When doing system scripting, I historically tend to settle on Perl. This is a habit I am trying to break.
Perl is quick and dirty and gets the job done. And the scripts I've written in Perl certainly look like it. I looked at a Perl script I wrote about six years ago and... I have no idea what it's doing! I'm sure I could figure it out if I spent a few minutes going through it (including blank lines, it's only 125 lines long) but that's beyond the point. I am reminded of this joke comparing Perl and Python.
I have some Python scripts already in use. Perl's object model is painful to me and I have a hard time making use of it. So where I've decided to use objects because it makes more sense that way, I have used Python. And I find that the scripts using Python have a little more readability when read in the future. (To verify this, I looked at a script I wrote over seven years ago.)
The vast amount of existing scripts in Perl require me to continue to use it in the near term. However, as I touch the scripts less and less, the less I remember about them and, therefore, the higher the cost if I need to make changes to them for any reason. And since I would like to minimize the amount of time spent trying to reunderstand code, I think moving away from Perl makes the most sense.
What I haven't decided on is what language to use in the future. This will require further testing and gaining more experience with other languages in doing the sort of tasks I use Perl for. However, I will eventually have that experience so Perl's days are numbered.
Comments
Object Models
Larry borrowed Python's object model for Perl; how is Python's object model better?
Re: Object Models
I'd like to apologize for the delay on replying. Apparently the comments interface isn't sending emails like I thought it would.
The simple answer to your question is: I am more familiar with it and, therefore, I am more comfortable with it.
There is fundamentally nothing wrong with Perl's object model. However, I never familiarized myself with it (having not needed objects in Perl) and when it came a time to write a script that required (at least to me) the use of objects, I went with Python because I had done Python scripting before and I knew how to implement objects in it. There was also an illusion that objects in Perl were cumbersome and hard but this was just an illusion brought about by my own ignorance.
This same ignorance causes the "pain" I said I felt when dealing with objects in Perl. Taking the few minutes needed to go over the perlobj and perltoot documentation has been very educational.
The reason I want to move away from Perl is because of cost of maintenance. (This, however, could be more a perceived cost than a real cost.) Cost of maintenance is more a function of the coding practices of my colleagues and myself rather than a function of Perl. Having established that I am the enemy here, it makes more sense to limit the damage I can do and one way to do this is a language that does not lend itself to cleverness density. (However, this could be because, at this point, I am less familiar with Python than Perl. And apparently there is Python golf...)
It could honestly be that using Python more will fail to solve the problem I have identified. It could also be that I have identified the wrong problem to fix...
Add new comment