At work I’m writing some basic C# applications, to help out so that our sole applications developer can concentrate on the more important tasks. I can’t say that I like C#, particularly, but I can’t say that I dislike it either. I am, however, struggling to approach my C# programming with the appropriate mindset.
PHP is undoubtedly the language with which I am most comfortable. I know many of the functions (and perhaps more importantly, know how to navigate www.php.net to find the ones I need but don’t know), and have a substantial body of experience with the language. If a task is too complicated for a shell script, I’ll often write a command-line PHP script to get the job done. I’ve probably written (and, unfortunately, deleted) more than a dozen such scripts to solve specific problems at work and home.
Before digging into PHP, I tried really hard to learn perl. I learned enough to be able to script those tasks at work that needed scripting, and that was about it. In truth, most of my perl looks more like bash scripting than perl; but that’s because I never really mastered the language. Since learning PHP, I find myself having to re-learn perl on a fairly regular basis: some script needs tweaking in some slightly non-trivial way, so I need to re-learn how to open a file in perl; or how to parse the command line arguments; or whatever.
I surprised myself today when I wrote a simple perl script to parse a text file into the format I needed by not looking up any information. I took a wild guess that
$_ was the implicit variable for “the current input from STDIN”, and was pleasantly surprised to find out that I was right (or, if I wasn’t right, at least the desired result was achieved).
I freely admit that I greatly prefer loosely typed scripting languages that let me quickly solve a problem. I struggle with C# at work because it requires a level of discipline I’ve not yet mastered in programming. It requires me to think carefully about the problem, and devise a solution in advance, instead of just solving as I code.
It’s reminding me why I’m a systems administrator who likes to dabble in programming, rather than a programmer who likes to dabble in systems administration.