http://www.perlmonks.org?node_id=615107


in reply to Re^4: Programming *is* much more than "just writing code".
in thread Programming *is* much more than "just writing code".

The answer to the problem of encountering code you do not understand, is to educate yourself.

Look it up or ask someone!

A code example, including some comments I have used:

# add attributes to object my @fields = (keys %{ $attributes }); @{ $self }{ @fields } = @{ $attributes }{ @fields }; # hash slice

The first comment gives someone skimming the code a hint about what's happening here (that they can figure it out by close study may be likely, but making them engage in that study just to find out if this is the part of code they care about is at best inconsiderate).

The second comment, "hash slice", is the sort of thing a beginning programmer would need in order to have a hope of looking up the technique in use.

The fact that the level of knowledge of the audience is uncertain does not obviate the need to address the audience at a certain level. Would you argue against explanatory subroutine and variable names because a really good programmer doesn't need those hints?