Tuesday, December 2, 2008

Part 3: Thoughts of “How we do?” - In Programming

We have a problem, we want to solve with computer. The computer is dump and we have to write a program, but it will run that for us any number of times without tired. Today lot of programming languages has invented, we are in high level language era. That is, we write programs in a language more like English/Natural language. Then have to convert those programs, mainly those will contains instructions to execute to perform some tasks, into machine code which can be understood by the machine/computer. These programming languages will contain rules or syntax to follow, any body can learn it.


Even though, if we know the syntax, we can't write a program for a given problem. We have to think what are the instructions to be run and in which order. We called this as algorithm. Some how, we have to identify the algorithm and build up them as a full program. Writing a program is not that simple as writing an essay. Our mind has to tell us what should be written.


From a simple problem to a complex problem, we should be able to think and write a program. It may be difficult, but our way of writing program definitely lead our brain think faster and find the solution for us.


In programming languages we have lot of opening and closing, for example in Java, a class body will be opened with “{“and closed with “}”. Improper closing makes compile errors and lead to spend more time to find out them and close currently.


Say we want to write the following class:

class MyClass{

     void method(){




we can write this first line (class MyClass{), then second line (void method(){), after that 3rd line only } and finally } to close the class.


Firstly we can write “class MyClass{}” then move the curser inside the “{}” and press enter key two times and move the curser to the second line and write the “void method(){}” etc.


In the second method, we may have to do more work/press more keys, but in the first method we have to keep lot in our mind, such “have to close the class body”, the logic etc. In the second method, once we closed the class body, our mind is free to think the actual solution, no need to think any think about those unwanted language syntax etc. In programming we have lot of like this, () - for method parameter, “” - strings, [] array etc. So, if we closed all of them immediately we opened and then think only in side, after that we should be able to see good improvement in our performance.


You may wonder, this is a simple thing, and we don't need to even think about this because our favorite smart integrated development environment (IDE) (Eclipse, Visual Studio, etc) would do for us. Of cause, yes! Now a days, all this IDEs are doing this. Even if I happened to evaluate a new IDE, I used to check this first. But, I wanted to check ourselves more in the following two cases.


First one, in case if we wanted write a program without IDE or in a new programming language witch doesn't have a smart IDE so far, then are we going to write in which way from above? If we are not going to follow the second way, then we don’t learn that our IDE teach for me.


Secondly, I could see lot more opening and closing in our programs, but even a smart IDE doesn't do for us. For example say we want to write a method, which suppose return a list of objects according to the logic. So I will start with method.


List doSomthing(){




Fine, what is next, I have to create a List and fill that with objects according to the logic, then return. But here I could see another opening and closing, that is, creating a list and returning it.


So, I prefer to add following lines to the method first before start other coding.


List doSomthing(){

     List result = new SomeList();

     //Think and write the logic here

     return result;



Now we have to think only about the logic, and that also simplified like as, check what ever you want, but finally add into the result list. So now, we got a direction also for our thinking.


Next, if we want to write some thing into a file, first we have to open and write something according to our logic and then have to close, and then only the content will be written into the actual physical file. This is also another example for this kind of open/close scenario. It is great, if we get used to write the open/close statement first before writing the logic in between that. This is applicable for most of the input/output stream programming.


It is obvious that we should be able to find more places where we can find the same open/close pattern in our programming life. If we could capture those and bring into our practice definitely it will change our way of thinking and programming. And not only this pattern, we have more patterns/practices which to be looked into. I hope those will lead us to not worry much about “What we do” and to will make us focus on “How we do”.


Saturday, November 15, 2008

Part 2 : Thoughts of “How we do?” – Is Experience Matters?

Thoughts of “How we do?” 
Is Experience Matters?

Again, I am starting with another example from my mathematical studies, in my school life, our mathematical teacher used to ask the following question. 
If x + 3 = 5 then how much is x?
We can simply say answer: x = 2. But he normally not stops with that. Next he used to ask that how you find that answer.
Again we can go for lot of explanations, but he wants only the following answer.
“If we add 2 with 3 only we can get 5, so x should be 2, no other number”
As usual, I have explained another arithmetical example, answer and a way of getting the answer. Is that all? 

No, we shouldn’t stop at this point and have to think further. We have to think that how he finds out the way of getting the answer. I agree not only him; most of us may have this ability of thinking in the way I explained. But, my question is how the way of thinking came to us and how we could switch between these kinds of different way of thinking. For example he would have try with conventional way of calculation like as adding -3 both side etc. But he did the way I explained early. Not only him, me too like the same.

Is this came from his experience?
Normally people don’t believe learning to solve mathematical problem will be useful in real life. Let us check another non-mathematical example same as this. In a project, we have an employee, project manager have a performance expectation. But we couldn’t get the expected performance. So here we have to provide something to the employee to get the expected performance. So that can be training, some motivation factor or just a small discussion. Here also project manager have the same formula as above. And have to identify the missing part in the left side.

First, we will check what we need to solve the above problems in conventional way. For the arithmetical problem, we should understand about 5 and 3. Not only that, we should know how to subtract the 3 from 5. That is, we should know the subtraction operation. For the project manager’s problem, we should understand all about the employee and the expected performance, finally the subtraction operation of them. Here it is impossible to understand them or very hard.

Let us check what we want to solve the same problems in the way my teacher expected. We just want to add some choices as 1, 2, 3… and check whether we are getting the result. And for the management problem again we have to provide some choices as training etc and check to see the expectation. Then choose that as the solution. It is mostly possible and we do the same for most of our real life problems.

So, if we want to solve problems in the way my teacher expected, then we should have much choice as 1, 2, 3 … or training etc. I believe this collection of choices can be increased with experience only. Here I didn’t mean just years of life; rather I meant to have an experience with focus on this kind of thing and a big collection.

As a conclusion, the experience may give different choice of way of thinking to get a solution. But I see that things like, switching between different solution methods and deciding how long to spend in one method; make more effect in our thinking patterns. And this is a kind of art; individual attitude or may have came with us when we are born. We wanted to think much on this. Let us check in another post.

Monday, October 27, 2008


பசுமை பொங்கும் எம் ஊர் வயல்வெளி,
பச்சை நிற என்னவள் ஆடைகள்,
வயலுக்கு நிறம் தந்தது அவள் நினைவுகளா? - அல்லது
வயல்கள் அவளை நினைவு படுத்தவா?

ஆண்டுகள் ஆகின்றன
அவளை மறந்து - அன்னியனால்
அன்னை மண்ணில்
அறுவடையும் இல்லையாம்.


ஆணிகளே மன்னியுங்கள்!
அறைந்தது வலித்ததுக்கு
அறைந்த பின்
அழகு தாங்கி சுவரில் நீங்கள்
அறை மூலையில்
அமைதியாய் நான். - சுத்தியல்

Friday, February 8, 2008

Part 1: Thoughts of “How we do?”

Thoughts of “How we do?”


Thoughts of “How we do?”

Let we start with one example. Hope most of you familiar with mathematical subtraction with negative numbers. “What is the result if we subtract minus one from minus one?” It is well-known that any school student can answer this question.

First let us represent in a mathematical formula as follows:

-1 - -1

We all agree the answer is zero. But the next question here is why or how you get this answer.

We definitely have to understand how we got the answer for above question, because this is not only one problem we need to solve. We have to resolve lot of same kind of problem in future, so understanding how we solve a particular problem is very much important people like engineers since their day to day responsible is providing solutions.

Let check the way how we can get the answer for the above question mathematically. First the value -1 is really unknown. It is something we can’t identify as a physical object. So definitely we have to change it to positive number to make our brain to visualize.

So we can start with right side operand -1, and we can first operate that with the minus sign and will get following expression.

-1 + 1

Now looks we are near to the solution. And the result should be zero.

Here is there any other way to get the answer to the above question? Yes, just check the following formula with a small change.

(-1) - (-1)

So can you identify the any different way to solve the same formula? If not, let represent (-1) with x.

X – X

Yes we subtract the same values so that should be zero.

So, don’t you surprise from the way we got the answer. Or couldn’t you understand the different between the ways of how we identify the answer.

Let us think the what leads us to think the second solution, it should be different from our usual thinking.