Tag Archives: languages

Perl as a 2nd language: Modules

This is part 2 of a series on Perl, intended for experienced software developers.

Re-learning Perl has not been easy. Continue reading

Perl as a second language: Step 1

Why 2nd languages? With hello world, and readme.pl

I want to help other people kickstart new programming languages. As an experienced developer, you already what a loop is, or any other common feature: you just want to make it work. The goal of my “second language” posts is to provide that level of help. Continue reading

Shell: ‘seq’ generates a range of numbers

I don’t use this often, but I keep forgetting it – probably because I don’t use it often.

$ seq 146 151

Too long is too bad

Long is good. Too long is too bad.

Steve McConnell tells us in Code Complete, that long variable names are good. I think it’s in the section on “Self-documenting code”.

In object oriented languages, you have the object name, the name of a possible sub-object, and the name of a particular field or item in the object, which all add up to a descriptive long name, but split into different parts.

Example: mypack.special-effect.color = chartreuse

However, I have been working in Gnu Make lately. Gnu Make recommends that you only use numbers, letters, and underscores in Make, as other characters may be used for other special purposes now or in the future. Now, in Gnu Make, you don’t have real objects. You do have “constructed variables”. By using recipes with wildcards in them, and constructing variable names with pattern substitution, you can get some of the same effect as objects. However, the variable names look kinda ugly.

Example: testset_special_effect_color = chartreuse

Its easy in make to get a few lines like the following. The intent here is to make a copy of one pseudo-object that will only be used when code coverage is in effect:

# Initial special effect setup
regression_mypack_special_effect_targets = \
  testset_chartreuse \
  testset_bland \
regression_mypack_special_exec = mypack_special_exec
# copy for code coverage
regression_mypack_special_effect_ccov_targets = \
regression_mypack_special_back_color_iterations := 4

My problem was that I copied the variable name wrong. In line 8, I wanted to make a copy of the list of targets, with the names modified to be the ccov version of the targets. The difference is nearly invisible in the middle of the long variable name.

Verbose, clear variable names are an important part of self documenting code. Monotonous names with only underscore separators make that hard. Yet another reason to avoid “make” for complex projects.

Fun OGRE meeting!

There was a lot of activity at the OGRE meeting tonight, including knowledgeable questions and answers, and a great video setup in a meeting room at Jaded Pixel Technologies (Shopify).

John Duff demonstrated the Devise authentication framework with Facebook.

Jonathan Sutherland was persuaded to show off his Rails-based real estate agents’ web site.

Dwayne recorded much more detail than I have in a post to the OGRE mail list, including code links.

Group Reviews

I have posted a list of Ottawa organizations that meet to discuss software-related topics. I have attended meetings of several of them  in the past and can recommend them. However, several I have not visited, so I can’t say what they are like.

Accordingly, I have decided to attend as many as I can in the next few months, and post a review here.

To be fair to all the groups, and to people who may have different goals in visiting a technical group, I will evaluate all the groups with the following criteria. They are very subjective criteria, so of course, ‘your mileage may vary.’ Continue reading

Splitting a perl program

Migrated. Originally posted: 2008-02-07

Like me, you have probably inherited a program or two that someone else wrote, and that could stand tweaking.

Any build system program needs updating as the system changes, with new demands, new technology, new builds. Perl programs can be structured to make this easy, or hard. I have a large program to tweak, and it’s all in one file – about 3500 lines long. 3500 lines is hard to work with in one file, so I am splitting it up. Continue reading

The ‘for’ task and other stuff I didn’t know about Ant

Migrated. Originally posted: 2008-02-03

While searching for Ant ways to loop over a bunch of builds and do the same thing to each, I recently had a look at Ant 1.7. It has been out for over a year, so it may show up in distros any time now. Debian will have it in “sid”, or you can use it from “sid” unstable now if you need it.

I also found out some interesting Ant tasks: <foreach> and <cc>, and the Ant subprojects Antlibs and Ivy. Continue reading

Languages to consider for your next project

Migrated. Originally posted: 2007-12-23

The Bugzilla project has recently discussed whether to continue writing Bugzilla in Perl. As far as I can tell, they are not likely to abandon Perl, but there was discussion about what language would be best.

I am mentioning this because Build Systems have some of the same characteristics as Bugzilla: Continue reading