Showing posts with label Perl. Show all posts
Showing posts with label Perl. Show all posts

Wednesday, February 4, 2009

A Space In The Right Place Saves Nine

Experienced programmers please set down any hot liquids before proceeding. The following comments are from a beginning programmer, and as such, will likely promote laughter among those who know better. That's why I'm writing this - you guys just can't regress all the way back to this level of ignorance easily :-)

The one thing everybody knows about Python is that whitespace is significant, and it's really a pain. OK, so now that I can do 'Hello World' in three - count 'em three! - different scripting languages, what do I think about Python syntax?

I just don't see why everybody thinks it's hard. To me, it's a breath of fresh air! So far, the only time I've seen that white space matters is leading whitespace to set off a block of statements.
There's no 'end' to that block except the ending of the indentation. OK, so it's something to keep in mind. On the other hand, bash's use the $ when you assign the value and not when you use it is a lot more confusing. And don't get me started on Perl. When to use a ( vs a { vs a [ is a lot harder to figure out, and $ or % or @ for variables ain't exactly simple either. Yes, Perl logically hangs together, and I get the fact that you should know which symbol to use when based on what you are trying to do, and what kind of data you are storing. I even appreciate the fact that it's a form of error checking - because if you use the wrong symbol because of a logical error it'll catch it for you.

On the other hand, in Python a variable is a variable regardless of the contents. The programmer has to keep it straight in his head rather than the syntax enforcing it. It might make things more error prone, but it sure makes it easier to read. The lack of end of line characters in particular is refreshing, unlike bash's 'you might want to use a semi-colon here - or not...

So, if you were thinking that counting spaces was a necessary evil in Python, forget it, and just try it out and see what you think!

Thursday, January 15, 2009

Running In All Directions At Once

So, since I claimed I was interested in other things lately, what the heck am I going to put on this blog? Other stuff of course :-)

Here's one topic I'll be returning to again and again. I might finally stop saying "I'm not a programmer". I can't go back to school (unless somebody's willing to foot the bill) but I can try and figure this out on my own. Lots of people do it every day. I don't expect to get really good at it, but hey - who knows?

I'm starting for that old open-source traditional reason - I've got an itch to scratch.

I do know a smidgen of bash scripting and Perl. I even did a complete website from scratch using Perl and MySQL with a bit of help from a friend. The problem I find with Perl is the same thing pointed out in one of the Perl books I read. If you don't do Perl every day and really work at, it doesn't seem to 'stick' with you that well. When I go back and look at old work, I have to really stop and look at it to figure out what's going on. To boot, the whole 'object orientated programming' paradym didn't make all that much sense to me in Perl either.

My itch is actually to contribute some code to an existing project. It does a lot of what I want, but not all of it. I've even posted my ideas to their bug tracker, but it doesn't seem like anybody else is going to do the work for me, so maybe it's time I tried to do it myself. That project is written in Python, and Python should be a good thing to learn for lots of reasons.

Python has the reputation as being easy to learn, and very versatile. Lots of modules and add ons are already out there, and it runs on Linux, Mac and Windows. I've seen lots of interesting end user programs that are written in Python, and I might be able to get something that looks good as well as working well.

So, I need to learn Python. And revision control. And project management. And lots of other things too :-)

I'll post tidbits as I go along here, and I'll start tagging these blog entries better so my mythical audience can skip the parts they don't care about.