Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Reading the same text and getting a different impression

by fraktalisman (Hermit)
on Mar 19, 2005 at 22:36 UTC ( #440955=perlmeditation: print w/replies, xml ) Need Help??

A few days ago, I saw a trailer on CNN in favour of their teletext. A journalist first said that a picture was worth a thousand words, and the tearing down of a Lenin statue was shown. Then he remarked, that OTOH "in the beginning was the word", and there were printed examples of words that easily bring up many pictures and associations inside your head. The journalist then remarked that it had taken mankind a long time to develop the alphabet and that it was worth while to honour words.

This trailer later ignited a discussion about books and written text. I remarked that the internet, too, had begun with ASCII text and newsgroups, and that several books like "1984" as well as the real existing history of the socialist states where dissident writings were even copied by hand (Samizdat) proves the revolutionary power that lies within books and words. As all perlmonks would agree, I suppose. In books, ideas are compressed, to be unfolded each time a person reads them.

But now to a more interesting point of this issue. Each time I read a book, it provokes different ideas than last time, although the text itself has obviously stayed the same.

I then concluded that the same must be true for code.

I do not even dare look at the code I wrote in the old BASIC days more than ten years ago (I can't anyway, the disks are lost), but even perl code from, say, two years ago, often makes me think to myself "what was my intention? why did i do this?" and things like that. Like code just seems to have the same effect as literature, you read it again and again at different times, and you get a very different impression.

Now maybe this meditation, pointless as it may seem, could actually bring forth some new aspects of debugging. If I just had the time to lay code aside for a longer period of time, and then revisit it, all before releasing it, so that I could have different views on the same project. Unfortunately, my customers mostly expect to see their demands met in time, and there is no other person in the company to do a proper code review. But already a pause of several days, before revisiting the code, seems to have the beneficial effect of a changed perspective, and I think that is a great benefit to debugging!

  • Comment on Reading the same text and getting a different impression

Replies are listed 'Best First'.
Re: Reading the same text and getting a different impression
by Tanktalus (Canon) on Mar 19, 2005 at 22:46 UTC

    Might I recommend ... Code Complete and Writing Solid Code? They're a bit old now, but still just as true as ever, even if a bit C-oriented. The key is to:

    1. write clear code which is unambiguous
    2. write proper comments where you can't make the code more clear
    3. write proper documentation where you can't write proper comments
    4. redesign your code where you can't write proper documenation.
    If you can't write it clearly, that's usually because you can't think it clearly. And if your thoughts are unclear, it makes it much more likely that your code is incomplete (missing boundary cases, etc.).

    Of course, that's all easier said than done!

Re: Reading the same text and getting a different impression
by cog (Parson) on Mar 19, 2005 at 22:53 UTC
    Each time I read a book, it provokes different ideas than last time

    I never seem to read the same book twice... I guess it's because I always want to move on to the next one...

    the same must be true for code

    I think so too; you learn something new everyday and each time you read it you have more knowledge and experience than before, which allows you to see things you hadn't realized before. Moreover, you could be sleepy the first time...

    "what was my intention? why did i do this?"

    Perhaps you should review your documentation habits O:-)

    But already a pause of several days, before revisiting the code, seems to have the beneficial effect of a changed perspective, and I think that is a great benefit to debugging!

    It's a great benefit to ourselves.

    Note to self: look at my code more often.

Re: Reading the same text and getting a different impression
by chas (Priest) on Mar 20, 2005 at 00:28 UTC
    "I then concluded that the same must be true for code."
    I think it's true in many areas. I often look back at things I've done (including writing code, proving theorems, etc), and sometimes I realize that I really had a shallow understanding of that which I thought I understood well; sometimes, though, I'm surpried that I had understood something so well and wonder how I managed to do that. I do often go back and review things many times (e.g. reading the Camel book or others I've studied in the past.) The only problem with that is that is takes time from going on to new things - there's only so much time allotted to each of us - how to spend it is a puzzle...(hopefully one doesn't waste some of it trying to resolve that!)
    chas
Re: Reading the same text and getting a different impression
by zentara (Archbishop) on Mar 20, 2005 at 13:25 UTC
    You cannot step into the same river twice.--Heraclitus

    And it applies to code. When you look at the code a few months later, you are viewing it in terms of your knowledge at that point. You have learned in the meantime.

    We all, for some reason, have a bad habit of wanting a "static" world which we can hang onto like a rock. But "Everything flows, nothing stands still"; so jump in, let go, and "go with the flow".


    I'm not really a human, but I play one on earth. flash japh
Re: Reading the same text and getting a different impression
by tlm (Prior) on Mar 20, 2005 at 15:22 UTC

    A book is like a garden carried in the pocket.
    Chinese proverb

    I have tried more to re-read than to read, I think that re-reading is more important than reading...
    Jorge Luis Borges, author of "The Garden of Forking Paths" (and much else)

    the lowliest monk

Re: Reading the same text and getting a different impression
by samizdat (Vicar) on Mar 21, 2005 at 14:08 UTC
    I like the spirit of your musings, fraktalisman++

    I review projects on several levels. Not only does code get a review, but the project specs and goal sheets do too. My best projects usually have a period of wild coding where I do five or six problem-specific variants. While I'm dousing fires, I'm filing ideas about generic data structures and partitioning that will allow me to generalize. Usually, some other burning task (like a weekend!) will intervene, and, before I get started again on putting out fires, I'll rewrite my code, at least to the point of implementing core data structures and config files that handle most of the variants I expect to see in a much more flexible way. Another week's firefighting, and I'm ready to do the same thing again, changing variable names, doing function grouping, and reworking parameter passing and such. I'm of two minds on commenting; I use commenting to separate subroutines, but I rarely do in-line commenting like I used to do with assembly. The acid test comes when I need to pass my code along to others, especially those who are not competent to handle multilevel references and embedded state- and language-driven coding.
Re: Reading the same text and getting a different impression
by johndageek (Hermit) on Mar 22, 2005 at 14:52 UTC
    Fun musing fraktalisman

    How we assimilate data has been of interest for a long time. First realize that all we experience is an abstraction, since the brain has no direct contact with the world. Sight is the result of a chemical reaction in response to light that is fed into optic nerves which the brain translates at several levels Visual Cognition Lab Touch, smell and taste are all abstract interpretations of the world around us.

    One interesting thing about growing older is that it is easier to see how various experiences affect my perception of things. (as a kid I cheered on Peter Rabbit, as a gardener I cheered Mr. McGreggor).

    This is just the abstraction and interpretation on the receiving end. Now letís look at the output or originating end. Words and visual art are both inexact ways of expressing feelings, ideas and thoughts through a static media. Wow! It is amazing that we can communicate at all.

    Now here is a question: how can you express an emotion to someone who has not experienced the emotion to the depth you have experienced it. For example, how far would you go to protect your child(ren)? This is a situation a person without children believe they can understand as I did before my wife and I had kids. Now that statement evokes a set of feelings with a depth I never knew existed before.

    So letís look at a book ( a static presentation of ideas and thoughts by an author at a particular point in their life). We read the book having had an entirely different set of life experiences, can we possibly truly understand what the author intended? Now, several years later, re-read the book and we will have a different understanding of portions of the book, becaus of our additional experiences.

    Switching over to the code review question. How could we not view code differently after a time? We will have gained experience which will change our view of the code, better ways of accomplishing a task will have occurred to us and so on. Good luck and thanks for a fun post!

    Enjoy!
    Dageek

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://440955]
Approved by Tanktalus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2019-03-22 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How do you Carpe diem?





    Results (114 votes). Check out past polls.

    Notices?