Posted by Sameer on 2:36 AM
Labels:

Wikipedia defines logic as the study of the principles of valid demonstration and inference. When we face a problem, we apply brain to get through it. i.e. We apply some logic considering the surroundings, the type of problem and the tools we have to solve it. The problem we face might be a real life difficulty, a mathematical problem, a scientific query etc.

Sometimes, Logic gets applied even when we are not conscious of it. On the other hand, sometimes we have to think really hard to solve a simple problem. Sometimes, In spite of knowing the solution, we fail to reach the same. Why do you think this happens?



Now, Consider the following problem.
Draw a circle when you are provided with a pencil and a scale.
Solution:


Draw a circle when you are provided with a pencil and a pro-circle.
Solution:




What do you observe? The logic applied in both the cases is different from one another. Also, The nature of your circle changes depending upon the instrument you use. By using a pro-circle, fine circle can be drawn. Circle drawn using a scale is not fine. A particular problem can be solved in many ways. The nature of solution differs for each approach. Now, if I reduce the length of each line used to draw the circle, the circle drawn using the scale can also be made fine. To find an optimum solution for a problem, sometimes you may have to apply extra efforts. For a brain, these efforts depend on the 'things' and 'tools' a man has and also the surroundings.

Now, let us come to my topic. Wikipedia defines Programming logic as the use of mathematical logic for computer programming. My experience is,'more than 60% of people find it to be very hard'. At first, I used to think in the same way. But when you know the reason of it to be difficult, it starts becoming easy. Let me explain my point. C++,Java,HTML, Visual Basic, Game editors are some of the programming languages, I'll be using for reference.

In computer science, Programs are written in specific languages which can be understood by the computer. C,C++,JAVA,Visual Basic are some of them. Now, my point is, one can not draw a circle if he/she doesn't know how to use a pro-circle. It does not mean that one doesn't know, how a circle looks like. The only problem is, he is unaware of the approach to complete the task.
The main reason of one being unable to write a program or to apply a logic, is not because he is an dumb-ass in computer programming. The cause behind this is, he is not familiar with the ways and tools to approach the problem. I don't disagree the fact that the lack of knowledge of a concept is responsible for one being not able to tackle a problem. But, I think all of us know 'how to add two numbers'.

Consider an simple example.

A variable 'a' has a value '10' and 'b' has a value '15'.

Consider following code snippet.(Code is in C++)

if(a>8 & b=15)

cout<<"true";
else
cout<<"false"; ('cout' in C++ is used to print a message.)

The output of the above program should be 'true'. However, the computer gives an 'error' and can not execute the code. The correct code is:

if(a>8 & b==15)

cout<<"true";
else
cout<<"false";

Now the output is 'true'.The logic I applied was perfectly all right.You also must have applied the same logic. The only thing I didn't know was the symbol for 'equal to' in C++ is '==' but not '='. Is it not cool? One thinks that the logic he has applied is wrong.

Once you get familiar with different tools, accessories, options, commands and techniques of a programming language, the only thing that remains is to apply logic which suits the above environment. You need to apply different logic in different languages for solving the same problem.

'Logic' and 'Language' are two different things.But they follow the same universal law.The 'Logic' can not be expressed without a 'language'.The 'Language' is senseless without the 'Logic'. Language and Logic do influence each other. Apply the logic, know the language and your problem gets solved. That's the way of programming.



You should ,Someday, peep into the world of programming. It's easy. It's simple. It's beautiful. You would love it. I'm sure.
-----------------------------------------------------------------------------------------------


This post is dedicated to my wonderful brother 'Siddhesh' who was the first to teach me the true meaning of 'PROGRAMMING'.



8 comments:

Unknown said...

Easy, simple are the relative terms here.
But, True, it's beautiful.

Quote:
one can not draw a circle if he/she doesn't know how to use a pro-circle
Well, Pro-circle in not the only way. One can draw circle without it...
The point is not about drawing the circle, though you make it fairly straight, But the actual the point is the 'willingness' to draw the circle.

Secondly, you could have explained it in the simpler manner... How about the first program on which you used your 'brain'. It was fairly simple, was it not? All that mattered there was a 'will' to solve it.
Go ask your friends, how many of them, even academically being brighter than you would be able to solve it?

I hate it when people say that JAVA / C++ or [Insert any name here] is dificult. Why blame the language or program when you suck?

It's the logic you should know... Learning a programming languages only means learning a syntax.

Unknown said...

Ooh ooh... Wait I forgot.

if(a>8 & b=15)
cout<<"true";
else
cout<<"false";

The output is TRUE.
And the C++ Compiler won't give any error.

It is a single condition check for value of variable 'a' as die to the assignment operator being exploited. :)

This definitely establishes that "YOU" still "SUCK" at both logic and language.



*Sid flexes his tongue at you and POOF! (He vanishes)*

Sameer said...

(It is a single condition check for value of variable 'a' as die to the assignment operator being exploited. :))

~C++ compiler gives an error. I have cross checked it. It doesn't matter if I use '&' instead of '&&'. But '=' is not allowed and I KNOW IT'S BECAUSE ASSIGNMENT OPERATOR IS BEING EXPLOITED.

(It's the logic you should know... Learning a programming languages only means learning a syntax.)
~I think, My post says the same.

(Pro-circle in not the only way. One can draw circle without it...)
~My dear bro,I can draw a free hand circle as well. The point is, One is unable to solve a problem since he fails to apply logic(to decide approach)with the tools he has, even when he knows the solution.


(All that mattered there was a 'will' to solve it.
Go ask your friends, how many of them, even academically being brighter than you would be able to solve it?)
~'Will' is always required when you learn something new. However, not everyone gets the 'start' like the one I had.'Will' needs the support of 'motivation'

Unknown said...

'Will' would lead to Motivation.

I have seen a many who had will to learn the logic and have done so, despite the shortcomings on required resources.

But, unfortunately, I have seen masses who have all required resources, and all ready motivation, like their parents or relatives in Software firms or connectedf to programmings by some means... But, they son't learn it. They still don't have the will.

You cannot change the person unless he or she wants to change himself / herself.

It's a really good effort bro. I think the masses out there of your own age, or even of my own age should read this. If they do, I daresay your efforts have flourished by a little.

Unknown said...

a fantastic post once again nd dis time it was d best post.........
I too realize d difference b/w language nd logic......
thnkzz a lot.............(god bless u)

Sameer said...

"'Will' would lead to motivation." I say, this is right. But , I interpret it in a different way.
Let us talk about programming. A person has 'will' to learn programming. He writes a simple program, applies correct logic and then finds that it's not working. This might discourage him and then he might not be keen to learn the programming.

I would say, The logic which you apply may not work sometimes due to some rules and syntax of particular programming language. In such cases, you'll have to apply logic which suits the environment. In either of the cases,The solution or target is known. It's the approach which makes difference.

So don't quit, even if your approach fails.

I don't mean support and motivation from families, friends etc.

Sagar Kolte said...

You are encouraging people to explore and learn programming. This is a good thing. But I see some vagueness in the first paragraph and at a few other places in the text, try to avoid that.

Unknown said...

As we had already discussed, let me make one point clear, The core logic remains the same ion most cases unless the entire language is changed.

As you had said, Logic and Language are two different things, but they do influence each other.

very true. But realize the differences as well. You cannot make scale draw a circle so easily and you cannot make a pro-circle draw a straight line so easily, The methods exists, however, way too complicated.

Yet, the fact to be noted by beginners here, that not to be discouraged if a perticular language doesn't appeal to you. It's not your fault. :)

Post a Comment