Thinking Like A Programmer.
Hello There, In last section we talked
about how to start coding. If you have read that article I have
mentioned there that for now the thing that is important for you is to “Think
Like A Programmer”.
What Basically “Think Like A Programmer” means?
Well, to think like programmer means to
think how you can make computer to do the things you wanted to get
done. Little confusing, but I will explain this by example. Let's
consider simple example,
You want to find biggest card in set of 10
cards.(You may be thinking,What kind of question is this?).
Yes, This is very simple you will see cards
in deck and will pick biggest one., isn't it simple. Yes of course,
if you want your friend also to do the same, you only need to tell
him,“Find the biggest one”. He will do the same and will give you
biggest card. This is a simple task for us. Actually our brain is very much smarter then what we think of it and one more factor we
have is our 'eyes' that helps us in many ways. But this is not the case when it comes to
computers and when we want computers to do the same thing, we can't just say
“find the biggest one”. Because computer doesn't know English and
even if it does, it will ask you, “How do I find it?”. So have you
noticed difference between a human mind and a computer. (You have been
learning since you were three or four and you have learned a lot of things, but not computers :P ). So you need to tell computer step by step
everything,
that is tell computer,
1. To pick two cards and keep them in
both hands,
2. Compare them, keep bigger one in one
hand and throw another one
3. Now pick another one and keep it in
second hand
4. Repeat step 2 and 3 until cards end.
5. Now, at last the one left in your hand will be
biggest one.
So by doing this we can make computer find how he can find biggest card but you will need some methods( or code ) to make computer to do comparison part and some storing methods to store values, right.
So you have came across two basic parts of a
code-
- Data Variables (Data Structure)
- Algorithm
Every code has above two things or say only these two things.
To conclude, you need to think how to make
your computer work, so that you get desired values(like mentioned above). This
is what basically thinking like a programmer means.
Rajat Sir _/\_ !..
ReplyDeletebas ab party hi bachi h :P