Draw the Lines

These day I have drawn many pictures based on the Bible’s stories. I like it very much, but I like to write about my experiences in programming, too.

Yet these days I had nothing special to write about it, which means my work went very well.
“Thank God” – I don’t know whether I could use this word in pure meaning, or it should be ironically used. In your world of christianity, the existence of God and Jesus would be so fundamental in your lives, so there might be various meanings to call Them. So I use my own word to thank God: “Kamisama Arigatou Gozaimasu, my work had been zu well to write something here.”

Today I had indeed a difficulty to understand a block of a source code which were provided by Google Android development team in the development kit.

It was like this: the reason the image is a bit too small is that I don’t intend to write in detail about the source (the code is from ApiDemos.java in Android SDK sample).

This block was so complicated, because it included many of a peculiar pattern, like:

x = y == z? v:w;

It means, if y equals z, x is assigned with the value v, otherwise with the value w.
In the above block this pattern was used iterated, cascaded, or in many ways. For example:

if ( ( x != null? y:0 ) == z)

It’s meaning is dependent on whether x is null or not null.
In the case x is not null, it means “if( y == z )”.
In the case x is null, it means “if( 0 == z )”.

Well, I might wrote wrong, because such expressions were so complicated, and now I am quite tired after struggling with them.

The block contained in this way so many “if” sentences, which meant if some part of the sentences was used, some of the other part became completely unused. If those unused part were hidden, the whole block would be easier to understand.

So I took the method below:

(1) I took a screenshot of the source code in the editor, as I show the one above.
(2) Opened it in a painting software.
(3) Magnified it larger.
(4) Using a colored brush, drew lines on unused part of the block, corresponding to each case:

In some case,

or other,

Thus I managed to understand the whole block.

I drew those lines manually, using the mouse. What I liked to say today’s post is: it was an analog way which was more effective for my study on computer. Yes, it was quite analog, except that an LED display was used instead of paper.


2 thoughts on “Draw the Lines

  1. In the case of this code, less was more! I like the anecdote hidden in your post–sometimes you have to take things away to figure it out. Sometimes I will do that in a photo. I’ll feel like something is missing, so I’ll take out a few things and nothing is missing anymore. :D

    • Oh Yes, I see you make always great effort to make the best of your photo, which gives me many ideas. Photos, computing, cooking, playing music…everything is done by contacting with samples and making experiments. All that have curiosity and ambitions to do anything can be inspired each other!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s