Wednesday, April 23, 2014

The Evils of Perl (or Logic Should Make Sense)

The people who know me professionally (even a little) have probably picked up on the fact that I hate Perl. I spent several years as a sysadmin, so I come by my Perl aversion honestly.

Don’t get me wrong, it’s a useful language and I found it to be a very handy tool, but it’s so very easy to make code that even the person who wrote it isn’t sure what it does. The next day.

Or it could be that I’m a crappy developer. Either’s possible. Maybe a little from Column A and a little from Column B.

It’s the only language that I’ve seen where your cat can walk across the keyboard and come up with a valid program. What does it do? We may never know. It may parse a file for a list of addresses, trigger an ICBM launch, or create animated gifs of dancing cats, but by gum it’ll run.

Personally, I’m hoping for the dancing cat gifs. Everyone loves dancing kitties.

My standard quip for why I finally stopped coding Perl is that in any sane language, to get the length of an array, you do something along the lines of myArray.length. That may not be exactly how it’s done, but it will be something similar.

In Perl, you do the following: $myArray = @myArray

You assign the array variable to a scalar variable (single piece of information. Int, char, etc.). This to me makes zero sense from a logical standpoint.

I made that comment about a week or so ago, and the person I was talking to said that it makes perfect sense because it’s an implicit type conversion. (I’m not sure if he was joking or not. I hope, and think, that he was).

He had a sort of point about implicit type conversion, but that sort of thing is supposed to follow a logical convention of some kind. For example, an implicit conversion from int to long makes sense (it’s basically just shoving existing data into a bigger container).

You could even make the case for implicit conversion between string and character array data types. I wouldn’t do it, because it’s probably better done explicitly so you don’t shoot yourself in the foot, but the argument could be made.

However, using implicit conversion to cast an array to (effectively) an integer in order to get the length of the array doesn’t make any logical sense. It’s like buying a chicken because you want a renewable source of pineapples.

In what non-Euclidian universe does this make sense?

“Well, I just need to figure out how long this array is, so I’ll assign it to a scalar and HOLY CRAP! THERE’S CTHULHU!”

Ia! Ia! ArrayLength! Fhtagn!

Any language that will summon Cthulhu by simply using it is probably a bad choice…

Now, if you don’t mind, I’ve got to Great Old One proof my office.

Current mood: Amused

Current music: Charlie Daniels Band – The Devil Went Down to Georgia

Tuesday, April 08, 2014

In The Beginning

In the beginning, there was a television. To the television was attached a Tandy TRS-80 CoCo. Then he said, let there be code. And there was code, and it was in BASIC. He was a child and found the fact that he could make a computer do things to be really cool.

As a teenager, the internet was laid open to him. HTML was discovered and there were many horrible mistakes made, including the dreaded animated gifs of flaming skulls and spinning things. The land was known as GeoCities, and it was eventually cast into perdition for its sins.

Then was Java made known unto him, and, though he tried, he found it confusing. This was the first age of Java, so he was not alone in this.

Lo then did he graduate high school and make his way to college in an effort to learn to do this shit properly.

There did he learn of many things – Pascal and Prolog, C and C++, Scheme and Assembly, Socket programming, the creation of data packets, and stack traces among many other skills and pieces of arcane lore.

He paid the campus ferryman with his toils as a sysadmin where he applied logic to a place of chaos known as a non-profit. All the while, using his position as an excuse to do things programmatically so as not to have to run around the hilltop known as The Ridges as often.

Then did he return to Java, and he found it…okay. After all, with a background in object oriented programming, data structures, and the like, Java now made much more sense.

Upon his path, however, he decided that Java was not the right tool for him, so he endeavored to learn C#. Additionally, in order to wipe away, or at least atone for, his past sins of using Perl, he also learned Ruby to an extent that would allow himself to get into (and hopefully out of) trouble on occasion.

He walked the paths of desktop development and eventually began to work in order to master the arts of web development as well using the MVC framework. So, then, did his past of using HTML and CSS come back to him (though, thankfully, the flaming skulls and spinning things did not), and that is where he stands as of this day.

Current Mood - Tired
Current Music - Shades Apart - Stranger By The Day