Should Kids Learn to Code?

Logic is not programming...this is coming from a mathematician. I am specifically interested in computational problems. That doesn't make me right by default, but feel my reasons do.

What most engineers and hopefully computer scientists are exposed to in terms of math is more or less not what I consider math. Most working mathematicians do not 'do' anything resembling calculus, or diff eq, or what have you. What we do is derive theorem X and prove. That is what math is...an exercise in logic.

I would say that where computer science uses logic is in its fundamentals such as the theory of computation, but you could also argue that that is math.

Nobody I know that writes any code, actually sits down and tries to do a tree diagram, or actually prove their code does what they claim. Maybe there is a world of coders I don't know about?

Does anybody ever write in their comments:

Premises X, Y, and Z

Claim: If X, Y and Z are true, then function do_stuff(var x, var y, var z) will return whatever.

proof: Suppose X, Y and Z are true.

lots of words...

conclusion...

No! Nobody does that with code.

But that is what logic is. It is a formal method that makes our thoughts and ideas clear and explicit and allows for no unchecked inferential steps. If coders did this, there should in principle be no mistakes in any program. But that is not really a practical way to write code.

http://en.wikipedia.org/wiki/Logic

In philosophy, Logic (from the Greek λογική logikē)[1] is the formal systematic study of the principles of valid inference and correct reasoning. Logic is used in most intellectual activities, but is studied primarily in the disciplines of philosophy, mathematics, semantics, and computer science.
 
I doubt anyone does anything like that, but there are parallels in unit testing and test-driven development, the latter especially. Write a test which will pass if the output of a routine returns the desired results, then write the routine such that it passes the test. The unit test is a means for a programmer to prove that their code does what they claim it does, and good test-driven development practice leads to greater code quality.

Not quite the same thing as defining premises and proofs, but it's fairly similar.

I know what unit testing is and I have even worked on a project in C# with test driven development and I we started going toward agile development.

I like unit testing, and I think programming is all about problem solving and in big way I think it teaches people to think. I just don't really think it is fair to think of logic and programming as being very similar.

Then again...there are languages like ProLog...which is pretty much logic..so. Let me revise my claim to say: "programming is not necessarily very much like logic, but it certainly can be depending on language and how it is taught."
 
Logic is not programming...this is coming from a mathematician. I am specifically interested in computational problems. That doesn't make me right by default, but feel my reasons do.

What most engineers and hopefully computer scientists are exposed to in terms of math is more or less not what I consider math. Most working mathematicians do not 'do' anything resembling calculus, or diff eq, or what have you. What we do is derive theorem X and prove. That is what math is...an exercise in logic.

I would say that where computer science uses logic is in its fundamentals such as the theory of computation, but you could also argue that that is math.

Nobody I know that writes any code, actually sits down and tries to do a tree diagram, or actually prove their code does what they claim. Maybe there is a world of coders I don't know about?

Does anybody ever write in their comments:

Premises X, Y, and Z

Claim: If X, Y and Z are true, then function do_stuff(var x, var y, var z) will return whatever.

proof: Suppose X, Y and Z are true.

lots of words...

conclusion...

No! Nobody does that with code.

But that is what logic is. It is a formal method that makes our thoughts and ideas clear and explicit and allows for no unchecked inferential steps. If coders did this, there should in principle be no mistakes in any program. But that is not really a practical way to write code.


You are talking about a full logical analysis- many other people are taking this discussion as 'basic' logic. ie, if 'statement A' then 'something B'

And in actuality, the construction of logic as you put forth above does happen. Most people would just call them complete programs, since they are small logic blocks built on one another (as you have described in your mathematical example).

Not arguing, just clarifying ;-)
 
Then again...there are languages like ProLog...which is pretty much logic..so. Let me revise my claim to say: "programming is not necessarily very much like logic, but it certainly can be depending on language and how it is taught."

-->

Thanks for adding support to my claims...not sure that is what you intended or if you realize that studying computer science is not learning to program.

I seriously doubt the class will cover anything close to turning machines or what have you....and as I said, that is more math and computer science imo.

So you've doubled back on your statement and are now claiming that computer science in no way has any relation to learning a programming language?

To say programming does not incorporate logic is like saying painting doesn't require paint.
 
And in actuality, the construction of logic as you put forth above does happen. Most people would just call them complete programs, since they are small logic blocks built on one another (as you have described in your mathematical example).

No...I think there is a sublet difference you are overlooking.

If programmers actually proved their claims (nothing inherent in writing code requires this to be done) then by definition the programs would not have any bugs. Show me where that happens.

Math actually uses logic, and you will notice that math is bug free in the sense that every correctly proven claim does follow from the premises.
 
I can see it being offered as an option for some kids. Way back when, I got to take a class in Shakespeare in lieu of regular English. :)
 
-->



So you've doubled back on your statement and are now claiming that computer science in no way has any relation to learning a programming language?

no...

To say programming does not incorporate logic is like saying painting doesn't require paint.


Whatever....this is a waste of time....I didn't think it was that hard to understand what is and is not really formal logic.

int main()
{
cout << "Hello world";
return 0;
}

What requires logic or resembles logic?

"learning to program" is not going to teach logic....I feel confident that that is a fair claim.
 
no...




Whatever....this is a waste of time....I didn't think it was that hard to understand what is and is not really formal logic.

int main()
{
cout << "Hello world";
return 0;
}

What requires logic or resembles logic?

"learning to program" is not going to teach logic....I feel confident that that is a fair claim.

Boolean logic? The logical operators? If-else statements? Putting together a loop?

Thinking through a program before you write it?

If I do this.. then this will happen..

What doesn't resemble logic?
 
If programmers actually proved their claims (nothing inherent in writing code requires this to be done) then by definition the programs would not have any bugs. Show me where that happens.

What you're not accounting for is that a developer can prove his claims and it be verifiable but bugs generally are the result of "proving" claims that neither the developer or tester ever thought of. A trivial but very common example being that text box accepts a numeric value to perform a calculation and that calculation through testing seems to be correct. But then later after the program has gone into production a user accidentally types in a non-numeric value and the programs breaks or crashes.
 
Boolean logic? The logical operators? If-else statements? Putting together a loop?

Thinking through a program before you write it?

If I do this.. then this will happen..

What doesn't resemble logic?

I'm getting the feeling that you and I have a very different idea of what is and is not logic.

Using operators and conditionals and thinking through a problem is NOT what I would call logic. Unless you claim thinking about a problem in a methodical and correct way is logic.

I don't...

Logic is about the analysis of thought such that we can determine the conclusions correctly follow from the premises.

********************************************
programming:

void stuff(int x){
if (x == 1)
{
do stuff;
}
}
***********************************************
Logic:

Claim: Over some restricted domain of x, stuff will do stuff.

Suppose x is 1. Then by definition of the conditional ==, the current instruction pointer will drop down into the conditional and execute "do stuff."

qed.
*************************************
The below is logic, because it analyzes the argument. The above is the function as coded it is not logic.


Does this not make sense?
 
What you're not accounting for is that a developer can prove his claims and it be verifiable but bugs generally are the result of "proving" claims that neither the developer or tester ever thought of. A trivial but very common example being that text box accepts a numeric value to perform a calculation and that calculation through testing seems to be correct. But then later after the program has gone into production a user accidentally types in a non-numeric value and the programs breaks or crashes.


True...I suppose. The proven parts should be bug free for what has been proven though. But I see that as a different than actually writing the code.
 
What a silly argument. Gym class doesn't help people become electrical engineers. Art class doesn't help people become lawyers. History class doesn't help people become mechanics. See what I did there? That argument is stupid.

They already teach the basics. Throw in some programming. Those who cannot swim will sink, and you know what? Screw 'em. Don't put in the effort, don't get out of school.

You're right, its not like the two top health problems in america are obesity and diabetes, but lets scratch P.E. off the list so we can encourage kids to spend more time on computers.

And history? What good is that? Why would we want an accurate portrayal of past so we can hopefully notice trends or keep from repeating the same mistakes?

TBH I could care less about art.

You want to scratch core subjects for a niche. Even if I don't agree with your argument that programming promotes insane logic and critical thinking skills, so do math and science! And I'm damn sure the average american will use some basic algebra and geometry skills before they will find the need to program anything. I would love to see a focus back on vocational education and trade skills. And IT or programming could be a part of that. I'll go out on a wing and assume you don't know the first thing about building a house, but I don't think you should have been required to take basic carpentry, engineering, and building code classes just because I think its vital knowledge.

The public school system is so messed up because of all we are requiring these days. I would much rather have every high school student be able to eloquently read and write, understand basic math, algebra, and geometry, basic knowledge of the human body and anatomy, an accurate sense of history and geography, and be physically fit than require people to take calculus and C++
 
I am begging my nephews and my own children to learn how to code.

You are a decent code jockey you don't even need college, it's a secure future.

I still want my kids to go to college, but coding is one hell of a fall back.
 
Hell No, the industry is saturated enough as it is with people that "think" they know what they're doing.
 
I am begging my nephews and my own children to learn how to code.

You are a decent code jockey you don't even need college, it's a secure future.

I still want my kids to go to college, but coding is one hell of a fall back.

It can be hard to learn when you're not good at it nor are you interested. I avoided learning how to do any sort of programming until I needed it to perform tasks for my job, before that it was one of the most boring and tedious subjects I did, and when something is boring and tedious, you don't learn all that much.
 
The below is logic, because it analyzes the argument. The above is the function as coded it is not logic.
Can the function be written without the practical application of logic, however? The definition of it, syntactically, expresses everything about its logic inherently (as though it were encoded in its syntax). Another programmer, when evaluating the function to understand its purpose, must construct the logical components of its design in his mind to be able to acquire a full understanding of it, including under what circumstances the condition is satisfied.
 
I am begging my nephews and my own children to learn how to code.

You are a decent code jockey you don't even need college, it's a secure future.

I still want my kids to go to college, but coding is one hell of a fall back.

It can be hard to learn when you're not good at it nor are you interested. I avoided learning how to do any sort of programming until I needed it to perform tasks for my job, before that it was one of the most boring and tedious subjects I did, and when something is boring and tedious, you don't learn all that much.

Yup. Some kids are wired differently. There may be a big bright future ahead for your son or daughter if they're interested in computers and programming, but not all kids are the same.

My brother and sister were both forced to play an instrument. They hated it. Hated every minute of it, and hated my mom for making them do it. She gave up, assuming I'd be the same, but I actually asked if I could learn how to play the guitar, and I loved every minute of it, and I've been playing my whole life. Everyone's different.
 
Can the function be written without the practical application of logic, however? The definition of it, syntactically, expresses everything about its logic inherently (as though it were encoded in its syntax).

I'm having a hard time getting a solid feel for your claim. Perhaps an analogy would work here.

I could argue that everything in math syntactically expresses everything about its logic inherently. So, greens theorem is clear from writing it down?

Or, if I write a function that calculates a Fibonacci sequence, or the nth digit of Pi. It is syntactically clear from the code that the function will do what is intended?

I am gonna say...no. Not to be spiteful, but I don't think your claim holds water, and I believe there are some good counter examples to consider.

Another programmer, when evaluating the function to understand its purpose, must construct the logical components of its design in his mind to be able to acquire a full understanding of it, including under what circumstances the condition is satisfied.

If you would like we can test your theory right here. I could write some code and you read it and tell me if it matches my claim based on the inherent logic in the code.

But if I proved my claim, it should be clear that my function does as claimed. Do you disagree with that?
 
There are lots of jobs that doesn't require coding, so it shouldn't be mandatory, due to several health problems related to computer, I imagine children would be more sensitive to these problems. This will only improve the income of health industry even more, therefore any decision to make coding mandatory would be political.
 
You want to scratch core subjects for a niche. Even if I don't agree with your argument that programming promotes insane logic and critical thinking skills, so do math and science!

Glad we're in agreement, then. Also, never once did I say I want to remove the subjects; those statements were in direct response to people claiming it is useless to learn programming in school because people who want to be x will never use it.

Funny how you want a bunch of competent readers and writers..

Logic is about the analysis of thought such that we can determine the conclusions correctly follow from the premises.

********************************************
programming:

void stuff(int x){
if (x == 1)
{
do stuff;
}
}
***********************************************
Logic:

Claim: Over some restricted domain of x, stuff will do stuff.

Suppose x is 1. Then by definition of the conditional ==, the current instruction pointer will drop down into the conditional and execute "do stuff."

qed.
*************************************
The below is logic, because it analyzes the argument. The above is the function as coded it is not logic.

...so what do you think happens when people read the code they wrote? Just because they didn't write it down in some douchebag formal manner doesn't mean they're not performing logic..

I mean.. you just stated outright that the below "logic" is the definition as to why the code is working.. did you NOT learn why code works? Were you never given a snippet of code and was asked "what will this do?".
 
In many ways you remind me of that board of education school commisioner that wanted to give iPads to every student. These are elementry school students mind you in lower income neighborhoods. "Put a computer in their hands. It will be great! Look at all you can do with it! It will teach them so much. And it's a bargain at $599!"

Learn how to use an iPad, it will be so helpful in landing a job. NOT

This is a large problem with the public school system. Spending money on fads instead of basic education. They tried the same thing with netbooks a few year ago, and it was a complete waste of money. Only reason they stopped this crazyness out here in California is because they are broke.
Instead, the governor has proposed doing away with much of the testing (can't allow testing that shows how badly the schools are really doing). They complain about having to teach to the tests, but at least it forces them to teach something. We live in one of the better school districts, but we still sent my kid to private school. The private schools also do standardized testing, and it amazing at how much higher her school is ranked when compared to the public school.

My kid has been using a computer since she was 1, but I see little reason for thier use in grade school, except for basic usage like office, and email, etc.
 
khanable;1038320182I mean.. you just stated outright that the below "logic" is the definition as to why the code is working.. did you NOT learn why code works? Were you never given a snippet of code and was asked "what will this do?".[/QUOTE said:
Logic is all about stating what something is in clear terms. That is a very simple example. That is logic...like it or not.


for a no trivial example I can download la pack and look at the code for matrix lu factorization yes? And if I posted it here, would it be clear how it works? Probably not...
 
No...I think there is a sublet difference you are overlooking.
I don't think he's overlooking any sublets.
If programmers actually proved their claims (nothing inherent in writing code requires this to be done) then by definition the programs would not have any bugs. Show me where that happens.
Programmers writing code with bugs is equivalent to mathematicians being wrong, which, despite what most mathematicians would like people to believe, happens all the time. So, yes, programmers are generally supposed to prove that their programs do what they're supposed to do, although they are not always successful. That is why they do what is called "testing."
I can see it being offered as an option for some kids. Way back when, I got to take a class in Shakespeare in lieu of regular English. :)
I don't see how that situation has anything to do with what this thread is about.
I'm getting the feeling that you and I have a very different idea of what is and is not logic.

Using operators and conditionals and thinking through a problem is NOT what I would call logic. Unless you claim thinking about a problem in a methodical and correct way is logic.

I don't...

Logic is about the analysis of thought such that we can determine the conclusions correctly follow from the premises.
Working through a problem in a methodical way is how it is determined that the conclusions correctly follow from the premises. You're talking about two sides of the same coin.
 
Logic is all about stating what something is in clear terms. That is a very simple example. That is logic...like it or not.


for a no trivial example I can download la pack and look at the code for matrix lu factorization yes? And if I posted it here, would it be clear how it works? Probably not...

Clear is subjective. I've played with code that has done LU factorization and decomp, so yes, it may be clear for me.

On the same token -- mathematics written down in your definition of logic is not going to be 'in clear terms' for some.
 
Working through a problem in a methodical way is how it is determined that the conclusions correctly follow from the premises. You're talking about two sides of the same coin.

I just depends, I guess, on what you do or do not call formal logic.

Writing code has nothing inherent about it that requires logic, and certainly not while learning it.


I am actually making an error too, I just realized.

We are talking about using logic. We are talking about using logic, using careful reasoning to verify claims. Using logic...is not logic.

Studying logic means you abstract away from specific applications such as C.S. Math or what have you.

So yeah, programming may use logic, but I don't think that means we are studying logic.


Sorry if I confused everyone...
 
I just depends, I guess, on what you do or do not call formal logic.

Writing code has nothing inherent about it that requires logic, and certainly not while learning it.


I am actually making an error too, I just realized.

We are talking about using logic. We are talking about using logic, using careful reasoning to verify claims. Using logic...is not logic.

Studying logic means you abstract away from specific applications such as C.S. Math or what have you.

So yeah, programming may use logic, but I don't think that means we are studying logic.


Sorry if I confused everyone...


vcJ9h.png







:p
 
Writing code has nothing inherent about it that requires logic
Of course it does. Logic is the basis upon which code functions. Coding is simply a series of logical operations through which a set of inputs are transformed into a set of outputs.
 
The public school system is so messed up because of all we are requiring these days. I would much rather have every high school student be able to eloquently read and write, understand basic math, algebra, and geometry, basic knowledge of the human body and anatomy, an accurate sense of history and geography, and be physically fit than require people to take calculus and C++
Agreed.

The purpose of the school system is to produce a thinking, independent, functional adult.
They fail miserably in too many cases.
Of course there are some people in this country that don’t want independently thinking individuals, but that’s for another thread :)

Too many kids need remedial math or English when they get into college. FAIL
Too many high school grads can’t even balance a checkbook, understand a loan document, or fill out a basic 1040-EZ tax return. FAIL

Part of the problem is that everyone is told you can’t be a successful unless you go to college.
Most occupations don’t really need a college education, a proper 2-3 year trade school should be enough.
I’m not talking about some of the worthless mills that turn paper MCSE’s for example, but real hands-on training instead.

Something else to consider. The average IQ in the US is 98.
According to one survey I’ve seen the average IQ for Computer Science workers is 128.
It’s a bad assumption to assume most the population is even capable of understanding programming.
Since IQ’s follow the basic bell shaped curve, for every person with a 128 IQ, you have to assume there is someone with a 68 IQ.
How are you going to teach C++ to someone with a room temperature IQ?
 
Back
Top