This week in geekville.

by gorthx

PDX.pm = 21 attendees, SRO.

Announcements:
– Call for shirt designs – we didn’t have shirts last year. I hope there’s enough interest for Josh to get women’s sized shirts again.
– We need speakers for upcoming meetings. (I almost got pegged for March. This got me to thinking of what could I possibly talk about at the Perl meeting…)
PDXPUG‘s next meeting will be Extreme Database Makeover featuring RT.
– This week’s lottery numbers: 6 15 21 32 7

Schwern‘s “Skimmable Code” talk started out with defining “lexical encapsulation”, a term I was curious about because I’d googled it before the meeting and the 3rd result was the meeting announcement; there wasn’t a really clear definition available. So: lexical scope refers to the scope of a block of code, and encapsulation means nothing leaks out (or in). Lexical encapsulation means that you can read all the code on the screen (a single screen, we’ll get to that in a moment) & know what it does, without having to look at the rest of the code to figure out what & where some variables are/do/come from.

This brings us to the concept of “skimmability” – how much of the code do you need to understand to do what you need to do (refactor, tweak, add new functionality). Can you get in, fix it, & get out without mucking up something else? You want small, self-contained blocks of code that will fit on a single screen.

Example of something bad: a global var in a subroutine – you have no idea where else it is used or what it does without reading the entire code. (Note to – I have the mother lode of “Pathological Code Base.” Let me know next time you need some examples. :) )

Tips:
– Andy Lester’s ‘ack’ is very useful for searches through multiple modules.
– Fun way to check your code blocks: pull the block out, run the compiler against it. That will tell you what needs to be passed in & out.
– version control comments: why you did it. What you did will be visible in the diff.
– enhance skimmability by using vertical whitespace; different things should be separated, similar things grouped.

My notes end here, as I had to leave early.

eta: Here’s something else I found that is relevant to this discussion:
Andy Lester – The world’s two worst variable names

Things I need to look into:
– Devel::Cover
– can I set cvs to ignore whitespace

Advertisements
%d bloggers like this: