Abstract Confusions

Complexity is not a cause of confusion. It is a result of it.

Commenting your code

It’s been a while since I blogged. I was actively following lot of topics, but mostly held my thoughts to myself from writing.

One such article I read was: Who needs comments? My code is self-documenting! aka: Comment tersely with value-added information.

The author makes the following point:

/* If the first field of the properties record is N... */
IF master_list(l_curr_index).properties_flag.field1 = 'N' THEN
a better way of writing it would be
/* If the customer is not eligible for a discount... */
IF customer_not_eligibility (l_curr_index) = 'N' THEN
As part of the suggestion, he suggests it is better to write a function, and code the business validation. Once that is done, there is no need for the preceding comment. The function is self explanatory.
I know coding style differs. But I am particularly edgy about a function returning TRUE for a negative check (I know, I know, it is just me, but still saying). I would rather rewrite the following:
IF customer_not_eligible (l_curr_index) THEN

into

IF NOT customer_eligible (l_curr_index) THEN

this way, I can use the same function to see if the customer is eligible (otherwise, you would be doing, “IF NOT customer_not_eligible (l_curr_index) ” which is double negation and could be confusing.

How would you do?

Abstract Confusions – 2011 in review

Got a nice report from WordPress. Though I did not blog actively in 2011, there are quite few posts that still cornered people’s attention. One of my new years resolution is to write more. So, sit firm and buckle up, here I come, 2012! :-)

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about 21,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 8 sold-out performances for that many people to see it.

Click here to see the complete report.

What’s special about 2012?

Happy new year to all. Wish you the most successful and happiest year ahead.

Now, that being said, let us look at the specialty of 2012. Being an even-numbered year, and a leap year, 2012 for sure is attractive.  Though few can complaint about having one extra day to get through in February.

2012 – Alan Turing year

2012 is named as Alan Turing’s year. Alan Turing was born on 23rd, June of 1912. 2012 will be his birth centenary year. He is widely respected for inventing theoretical computer and much of code breaking in Cryptology.  His contribution in war-time Britain saved scores of live and eventually lead allied forces to win world war II.

2012 – Cooperative year

2012 is also named as international co-operative year. Co-operatives or cooperative unions are special kind of business/non-business establishments. It is special to me, as I have studied a cooperative management diploma for a year.

2012 – Mathematical significance

2012 is also a E-Toothpick sequence number. Last year, 2011, we observed what as a toothpick numbered year. A E-Toothpick is formed by three half toothpicks, like a trident.

2012 : E-Toothpick number

2012 : E-Toothpick number

2012 – Mayan Calendar

The story of 2012 as the end year of Mayan calendar is well-known.  Even there are a handful of movies made on it. It is left to see what happens in 2012. Even if we have to go by Mayan’s, we have full year 2012.

Mayan Calendar till 2012

Mayan Calendar ends at 2012

2012 is has same calendar as of 1984, 1956 and will have same as 2040, 2068 (that’s +/- multiples of 28 years). On another side note, there is a move to have a permanent calendar. A calendar that has every weekdays of a month identical year after year.

From: http://www.cato.org/pub_display.php?pub_id=13940

Two Johns Hopkins professors are proposing a new calendar in which dates would fall on the same days of the week every year.

The calendar proposed by Richard Conn Henry, an astrophysicist, and Steve H. Hanke, an applied economist, begins each year on Sunday, Jan. 1.

There will one full week added every 5th or 6th year.

Do you like it? I do not. Not just simply for the reason, that there will be no new calendars printed with glossy models. Also for the fact that there will be no surprises in the holidays and leaves. Doesn’t it become monotonous?

Best of Classical Tamil One-Liners from Sangam Literature

சங்க இலக்கியங்களில் காணர்க்கரிய சொல்லமுதங்கள் அங்கங்கே உண்டு. முழு பாடல்களையும் காட்டில்லும் ஓரிரு வரிகளில், வாக்கியங்களில் உணர்த்தும் கருத்து வீச்சு அளப்பரியது. எனக்கு பிடித்த சில இலக்கிய வரிகள் இங்கே:

கற்றோர், பொருள் பெருமை

ஔவையார் பொருளை பற்றி குறிப்பிடும் போது. ஈவது அறம் என்றவர், பொருள் என்பதற்கு ஈட்டல் பொருள் என்று மட்டும் சொல்லாமல், தீவினை விட்டு ஈட்டல் என்று விளக்கினார்.

ஈதல் அறம். தீவினை விட்டு ஈட்டல் பொருள்

Read more of this post

On Counting, Countability, Uncountability and Confusions thereof

The very basics of math skills are not taught by any one, it is inculcated from birth. In my childhood days, I remember how I got surprised by my grand mother’s mathematical (rather counting) skills. She was not taught in any school, she has to manage the household stuff, few farm works. She could never read a word, but still she could precisely count the number of coconuts, add subtract multiply or tally the rupee notes and settle the account. Counting is something that comes naturally to one. In fact I read some where, counting is not exclusive to humans, birds like crows can count till five. Another news item claims chimpanzees can even count better than humans.

Asian Advantage in Counting

Another article even attributes geographical / language factors for mastering the mathematical ability of remembering number. If you haven’t read it, here is the summary: the article advocates the certain languages (Asian in this case) have inbuilt advantage in manipulating numbers in mind. Because, the words for the numbers are smaller and easy to store, retrieve, manipulate.

Chinese number words are remarkably brief. Most of them can be uttered in less than one-quarter of a second (for instance, 4 is ‘si’ and 7 ‘qi’) Their English equivalents—”four,” “seven”—are longer: pronouncing them takes about one-third of a second. The memory gap between English and Chinese apparently is entirely due to this difference in length. In languages as diverse as Welsh, Arabic, Chinese, English and Hebrew, there is a reproducible correlation between the time required to pronounce numbers in a given language and the memory span of its speakers. In this domain, the prize for efficacy goes to the Cantonese dialect of Chinese, whose brevity grants residents of Hong Kong a rocketing memory span of about 10 digits.

It could not help me but to compare this with the counting in my mother tongue Tamil.  In English, we have to count fourteen, sixteen, seventeen, eighteen and nineteen, so one would think that we would also say one-teen, two-teen, and three-teen. Not the case. It is little bit in a different form: eleven, twelve, thirteen, and fifteen. Compare that to Tamil counting, 11 is pathinoonnu (பதினொன்று or pathu+one; ten+one), 18 is pathinnettu (பதின்னெட்டு or pathu+ettu; ten+eight). Read more of this post

What’s special about 2011?

2010 is gone. And I always like even numbered years compared to odd ones. I was asking to myself, what’s special about 2011? It works out that 2011 is indeed special.

First: 2011 is a prime number. The fundamental building blocks of number system, prime numbers are special. It means 2011 can not be expressed a product of smaller prime numbers (or any other numbers for that sake). And then, a friend pointed out 2011 can be expressed as sum of 11 prime numbers.

Read more of this post

Abstract Confusions: Year 2010 in Review

Following is the statistics for the year 2010.

The stats helper monkeys at WordPress.com mulled over how “Abstract Confusions” did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Wow.

Read more of this post

Top Tamil Movies 2010: The Good, Bad and Ugly

Following last years best movies, I list down what I think the best, worst and forgettable movies in 2010.

Read more of this post

Some Interesting Requirements / Questions

Over the time I received few interesting requirements and questions. Few of them are straight forward that you do it in minutes, and few other questions are strange enough that some time have to sit and etch out the solution which is not top of the head. It would be only fair to share the information here. I would give you the requirement / question, if you can answer them, please add in comments.

You can use any language you like (except 3rd requirement). I was forced to use PL/SQL because of the project requirements.

Read more of this post

Dangerous Mind – Mathematics and Insanity

Problem solving is a top-notch skill. All of us face problems, in work, in life and every day happening. Jokingly mathematicians identify the following stages of a problem solving:

  1. Identifying the problem (includes preparation, collecting information, identifying challenges and risks) .
  2. Attacking the problem (use existing tools, techniques to derive new method). Get vigorous, consciously.
  3. The problem attacking becomes an unconscious activity from a  conscious one, then the problem starts attacking you.
  4. Either problem is consumed or the attacker is consumed by problem.

Especially at stage 4, one will be thinking only about the problem. While driving, eating, teaching and even in sleep. Archimedes resolved the problem when he was bathing. Isaac Singer, the american inventor of sewing machines was supposed to found solution for the problem of finding where to put hole in needle so that it is easy to stitch, in dream, he dreamt of someone chasing him with strange spear with a hole in the spear head. These are examples of sub conscious mind solving problems.

Read more of this post

Follow

Get every new post delivered to your Inbox.

Join 109 other followers