Showing posts with label programming_topic. Show all posts
Showing posts with label programming_topic. Show all posts

Tuesday, June 1, 2010

ruby and curly braces around statements

"In memory" of perl, ruby allows curly braces in "almost every place", where perl allows it. But it does not allow it for function resp. method definitions, and not for if/elsif/else. There it enforces the keyword "end". Correct me, if I'm wrong.

Tuesday, May 25, 2010

ruby and here-documents

Ruby has such a feature, and of course it's pretty, pretty useful. I found an article on here-documents in several programming languages at the English wikipedia.

Monday, November 23, 2009

using associative arrays in your code

How many lines of code does it take for your new piece of code, before you introduce an associative array?


How many lines of code does it take for your new piece of code, before you introduce a class?

Yes, I know, Bourne shell doesn't come with the concept of associative arrays, of course it also doesn't know classes or object orientation. Right, a simple 20 or 30 lines shell script for copying and renaming files may not have the need for associative arrays or classes. But if your script gets longer, pls rethink, whether Bourne shell is the right choice for your task, or whether you make really good use of ruby, perl, or python!

Your next steps may be writing unit testing and using continuous integration. It's not your customer, who should request it, it should be your serious professional style, your way to deliver proper services. If you are not familiar with the terms, look them up -- I provided you with proper links to interesting and informative articles.

Thursday, September 13, 2007

shell script pitfall: "elsif" instead of "elif"

I know, that shouldn't happen to a skilled shell script programmer, but it happened right now ... The "funny" thing was, that bash mourned about a syntax error only at the next "then". Of course, I can very well explain myself why that is, but still: Handling this error is "sub-optimal", isn't it?