Logic (That's what programming is centered around right?)

Started by
19 comments, last by cr88192 10 years, 1 month ago

So, let's peak over at Wikipedia for a sec, to the article on "logic."

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

So, yeah, big topic. Lot's of research. Years and years of exhaustive toiling over the meaning of meanings....

Now you want to be a computer programmer. You see a few tutorials, play with a few languages. Write a few lines of code...

But how is your logic and reasoning?

Are you a problem solver? A good one?

I figured after watching an iTunes U course on Computer Science that logic is the main topic of a college level CS degree.

How do we solve complex problems efficiently?

Do you think that logic should be a prerequisite to computer programming?

If so, why don't we teach logic in grade school as a separate course?

They call me the Tutorial Doctor.

Advertisement

I voted "It depend" because logic does play a role in programming, but it's not all that programming is all about (if it was electronics then ill say it's way more proeminent).

True, a lot of ifs/switchs/comparaisons are used in most programs, but they also work with numbers (add/sub/mult/div ect...) so logic is only half of programming id say, the other half being computational task and IO stuffs.


Do you think that logic should be a prerequisite to computer programming?
If so, why don't we teach logic in grade school as a separate course?

Well, i belive most programming course should include a chapter or two on logic, i learned mine in my electrician course, and it was really easy for me (i didn't knew programming at that time very much).

I voted "It depend" because logic does play a role in programming, but it's not all that programming is all about (if it was electronics then ill say it's way more proeminent).

True, a lot of ifs/switchs/comparaisons are used in most programs, but they also work with numbers (add/sub/mult/div ect...) so logic is only half of programming id say, the other half being computational task and IO stuffs.


Do you think that logic should be a prerequisite to computer programming?
If so, why don't we teach logic in grade school as a separate course?

Well, i belive most programming course should include a chapter or two on logic, i learned mine in my electrician course, and it was really easy for me (i didn't knew programming at that time very much).

I am not sure how to best classify or describe programming (at a meta level).

I think probably just thinking things and writing out whatever they happen to be thinking at the moment (in code form) probably mixed with a fair bit of trial-and-error, are probably a pretty big part of the process as well.

well, and also sometimes the "feel" of engaging in a direct fiddle-and-feedback loop:

fiddle with code;

recompile and test;

fiddle a little more;

...

though, in terms of the experience, it seems like it should need to be very fast for this to work, it sort of works with a cycle time of potentially many minutes or more.

spending too long thinking without actually doing anything can make one feel irritable.

sometimes, it may get to be one acting out of habit, maybe doing a few cycles or building and testing things for "no reason in particular", it can become somehow oddly soothing/relaxing.

then again, apart from this sort of thing, my life is pretty empty sometimes...

No. Formal logic is a prerequisite to electronics as has been said, and the start of any course in circuit design will almost certainly be a primer on boolean algebra, karnaugh maps etc. But taught in the context of logical gates. Context is everything in teaching and formal logic taught in isolation would seem meaningless and abstract, but put someone in front of a virtual circuit board designer so they can see how it relates to making a seven segment display output a number and you're golden.

Bitwise operations are increasingly "advanced" topics in programming these days and the higher level that beginners languages work in mean the kind of logic you need for programming is well divorced from formal logic and more in the realms of common sense - if/then, while, (logical) and, (logical) or are all concepts I'd expect people to understand without any formal training in logical analysis.

This is not the area which seems to be the barrier to beginners. Variables, control structures and normal maths seem to be. Drowning a beginner in formalized logical analysis would probably scare most people off as it would validate the misconception of programming as hard and complicated, as perpetuated by the Hollywood screenshots of dense, unreadable code in every hacker flick.

While formal logic has similarities to programming, it's really a separate field.

EDIT:
Re: Electronics.
Logic is not a prerequisite for electronics either. Boolean logic as used in electronics uses different symbols and terminology to formal logic, and is rather small subset of a logic course. Boolean algebra and karnaugh maps are better coupled with a math course or a circuits course than a straight logic course.

Formal logic is probably a bit over the head for most children in grade school, even many first year students at university struggle with it.

So I don't think it's really needed in grade school, but for any higher technical or scientific education it should definitely be included, and I would be surprised if there wasn't at least some course in logic in any such program.

But a prerequisite? no... you can go a long way in programming without any knowledge of formal logic, just using your intuition.

It definitely helps knowing something about it though (in programming, and in life in general...)

This is a bad question because "Logic" can mean many things. Primarily, it could be a branch of Philosophy or a branch of Mathematics. However, the answer is still "no". A smart kid can learn programming without any prerequisites whatsoever.

I started to program when I was 7. My dad taught me a few basic things about how his programmable calculator worked, and I played around with it until I figured it out. If instead of teaching me what "if" and "goto" do he had started by introducing Logic and whatever other things people think should be prerequisites for programming, I would have been overwhelmed and I wouldn't have learned anything.

First I voted "it depends", then changed my answer to "no" because people are lazy when it comes to definitions.

In order to program you need to think logically, you need to be able to reason through problems. You need to be able to explain a problem in terms of equations.

However, the ability to reason is very different than the study of reason. Most people are able to logically reason their way through problems without formal study on the rules of logic, how implication works, playing reasoning mind-games, or, (since you likely meant computational logic rather than logic generally) study their way through formal languages of logic or proofs.

Also, due to lax definitions, I would say no to 'prerequisite', but yes to 'corequisite'. You need the material at the same time you are learning to program.

Logic is a big field. You can get advanced degrees in the study and expression of logic by itself. You don't need that as a prerequisite to beginning to program.

Finally, while I will agree that computer science can rely on formal logic, that is not the core. I would argue computer science is an application of general mathematics rather than logic. The machines are computational engines designed around mathematics, the values used in computation are a perfect fit within discrete mathematics, and when programmed the applications frequently align themselves around mathematics topics like linear algebra, trig, accounting and verifiability, cryptography, and more.



Do you need the ability to apply reason and the ability to break problems down, build problems up, and find equivalent solutions? Yes. All of these are areas of logic that you need while learning how to program.

Do you need formal study on logic, the history of logic, philosophy of logic, semantics of logic, logic in debate, logic in philosophy, logic in mathematics? No. While these can potentially be valuable in a career, and many people in computer science rely on them, they are not a prerequisite to programming.

This is a bad question because "Logic" can mean many things. Primarily, it could be a branch of Philosophy or a branch of Mathematics. However, the answer is still "no". A smart kid can learn programming without any prerequisites whatsoever.

I started to program when I was 7. My dad taught me a few basic things about how his programmable calculator worked, and I played around with it until I figured it out. If instead of teaching me what "if" and "goto" do he had started by introducing Logic and whatever other things people think should be prerequisites for programming, I would have been overwhelmed and I wouldn't have learned anything.

yeah. I mostly started out fiddling with QBasic and later Turbo C and DJGPP and similar back when I was in elementary school (mostly on my own).

at the time, I didn't even really know what the order of operations were or similar, but it didn't take long to learn them from observation.

I did ok in high-school level algebra, but basically sucked at everything else.

got to college, pretty much sucked at everything.

and, as well, suck at pretty much anything life-in-general related.

not particularly good with dealing with abstract thinking either.

...

still reasonably good at programming though at least.

like, in life, there are relatively few things that actually make sense. programming seems to be one of them.

I suspect in many ways, it may be a lot more fundamental than all of the "meta" and academic disciplines and similar that people seem to try to glue onto it.


However, the ability to reason is very different than the study of reason

Hmm. Good quote. Question though, do you think that taking a CS course in college teaches you to reason at a higher level? And when it comes to computer programming, don't you think that a person should be able to reason at a higher level for that profession?

Sure, I can solve lots of problems, and I can reason through stuff, but there is no way I could write such complex algorithms as are out there to do complex tasks. It just feels like such reasoning/logic comes from college courses, and not from common sense.

The main reason I am asking this question is to find out if I need to learn about logic in order to become a better programmer, or at least a faster problem solver.

They call me the Tutorial Doctor.

This topic is closed to new replies.

Advertisement