Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Why pascal is not good

Author: Anthony Cozzie

Date: 05:55:58 08/01/03

Go up one level in this thread


On July 31, 2003 at 18:17:25, Matthew White wrote:

>On July 31, 2003 at 09:44:02, Anthony Cozzie wrote:
>
>>On July 30, 2003 at 21:42:31, Matthew White wrote:
>>
>>>On July 29, 2003 at 22:31:46, Vincent Diepeveen wrote:
>>>
>>>>On July 29, 2003 at 20:16:59, Matthew White wrote:
>>>>
>>>>>On July 29, 2003 at 16:53:05, Vincent Diepeveen wrote:
>>>>>
>>>>>>On July 29, 2003 at 03:15:54, Hristo wrote:
>>>>>>
>>>>>>>On July 28, 2003 at 19:12:56, Vincent Diepeveen wrote:
>>>>>>>
>>>>>>>>On July 28, 2003 at 17:34:46, Russell Reagan wrote:
>>>>>>>>
>>>>>>>>>Is there any reason to start new projects with C anymore? It seems like most (if
>>>>>>>>>not all) of the drawbacks of C++ have faded away with modern compilers.
>>>>>>>>>
>>>>>>>>>Note that I am talking about new projects, and maintaining old projects is
>>>>>>>>>obviously a good reason to still use C.
>>>>>>>>
>>>>>>>>If i would learn coding today i would prefer C++.
>>>>>>>>
>>>>>>>>However let's be clear, for good programmers there is not much diff between C
>>>>>>>>and C++. Every complex problem which you can solve in 10000 lines of C++ you can
>>>>>>>>solve in 10000 lines C too.
>>>>>>>>
>>>>>>>
>>>>>>>Vincent,
>>>>>>>with all due respect I must disagree. In 10K lines of C++ code one can solve a
>>>>>>>much more general or larger set of problem(s) or cram in more features. :)
>>>>>>>(think templates, exceptions, and often inheritance ... all of which can shorten
>>>>>>>your code)
>>>>>>
>>>>>>I do not know about you, but i program both in C and C++.
>>>>>>
>>>>>>Do you?
>>>>>>
>>>>>>Not a single program where you can use all the nice toys you can also make a few
>>>>>>functions for in C.
>>>>>>
>>>>>>In general the average programmed C++ program you program more compact in C.
>>>>>>
>>>>>>That's not what i'm talking about.
>>>>>>
>>>>>>If you do not know how to program in C, then just say it loud instead of writing
>>>>>>it down like this.
>>>>>>
>>>>>>the advantages of what you mention here (assuming 1 man products) you can show
>>>>>>great in 50 line examples or even 200 line examples.
>>>>>>
>>>>>>But as soon as you write a 10000 line product then it doesn't matter what you do
>>>>>>in C++. I can do the same in C too. No problem!
>>>>>>
>>>>>>>In your post, latter, you indicate that C++ offers some advantages over C,
>>>>>>>especially for large projects. In my experience this is %100 true, so we are in
>>>>>>
>>>>>>I see no other advantages to C++ than for big projects in fact.
>>>>>>
>>>>>>The advantage is *really* huge there for companies.
>>>>>>
>>>>>>Given the importance of those companies for the world, the choice to teach
>>>>>>students C++ instead of C is a logical choice.
>>>>>>
>>>>>>teaching them Java, delphi i find a bad idea.
>>>>>>
>>>>>The best reason that I see to teach students using Java is that Java gives you
>>>>>useful information when an error occurs (remember the first time you saw a
>>>>>segmentation fault how lost you felt?). Java has strong typing and it FORCES
>>>>>object orientedness. C and C++ are too frustrating for new programmers...
>>>>>
>>>>>Matt
>>>>
>>>>I agree fully with Bob here. His Pascal argument is very valid.
>>>>
>>>>Let me give you a bunch of reasons why you should not teach in a language like
>>>>that JAVA or delphi or pascal:
>>>>
>>>>  1) the students will later use the language they are learned. So
>>>>     if you directly learn them C++ they will use that. now they are doomed
>>>>     to use java or pascal because that's what they are familiar with.
>>>>  2) your students will earn thanks to that you learned them this toy language
>>>>     a lot less. C++ programmers earn better than Java programmers in general.
>>>>     In fact even some 'older' languages like fortran earn very well.
>>>>     Majority of
>>>>     programmers in netherlands at the KPN (which is about a 1000) is fortran
>>>>     programmers just to give an example. But also at supercomputers fortran
>>>>     is very important.
>>>>  3) If you learn them C++ you achieve 3 objectives at the same time
>>>>       3a - they learn a language they can later use
>>>>       3b - you can show them the great things of object orientation
>>>>            in 50 line programs
>>>>       3c - they are not fearing to program in C++ as they are familiar with it
>>>>  4) In big companies decisions get taken by management. Not by programmers.
>>>>     Managers in general are doing what is good for their company.
>>>>     If statistics show that 80% of all programmers with very small shoe
>>>>     sizes will make buggy code, then in theory the law doesn't allow you
>>>>     to discriminate. However managers do not work like the law there. They
>>>>     fear hiring someone who writes buggy code, so they never hire someone
>>>>     with a small shoe size if that statistic would be the case.
>>>>     Same is true for Pascal. Pascal is for newbies, exactly as you say so.
>>>>     Therefore managers will not hire people who are good in pascal, because
>>>>     a manager always finds out the truth. With his questions to the programmer
>>>>     the programmer in the end will confess he's better in pascal than in
>>>>     C++, so the manager concludes he's a pascal coder. So the programmer
>>>>     deduces from that he gotta be a crappy coder. So he isn't hired.
>>>>     Managers work very instinctive and they should. They are there to prevent
>>>>     disasters for their company, not to play the advocate of the devil which
>>>>     will say that a coder isn't a bad coder unless you have clear proof
>>>>     of that. Trivially it's easier to not hire someone than to fire someone.
>>>>   5) This really is important. In university and colleges they still do not
>>>>understand a thing very well and that is that 99% of the time you are busy
>>>>fixing bugs and 1% of the time you are busy creating something new. I will not
>>>>say throwing someone in the deep is a good thing. I have no opinion there.
>>>>But for sure it is better to learn to debug. Example at my own university out of
>>>>all the years that i was there i saw only 1 course which had 1 sheet which said
>>>>that debugging was important.
>>>>
>>>>All the other theories about debugging i have figured out myself. What is a
>>>>boundschecker. How the debugger works and how to effectively write testbeds.
>>>>
>>>>Your simple programming language when preventing severe bugs will definitely
>>>>create a bad coder. Someone who can't debug. That's a horror.
>>>>
>>>>If someone has followed your course i bet he can't debug. yet 99% of his time he
>>>>will lose debugging in his programming career.
>>>>
>>>>Programmers just starting their program i have always this discussion with:
>>>>
>>>>"Did you let it print to a log file all the lines is searched with alfa and beta
>>>>scores?"
>>>>
>>>>..
>>>>
>>>>"Why not?"
>>>>
>>>>..
>>>>
>>>>"SURE you must do that"
>>>>
>>>>..
>>>>
>>>>"yes i am VERY sure you must do that. How can you fix a bug in your chess
>>>>program if you do not know where it is and all you know is that it plays the
>>>>wrong move?"
>>>>
>>>>How many more programmers who just started their chess engine i need to explain
>>>>it to? They should learn this already at *school* IMHO.
>>>>
>>>>If you only teach someone to drive a car, why give him a flying license?
>>>By that same token, if you are teaching someone to drive, do you need to teach
>>>him on a Formula-1 Racecar? I agree that certain constructs in C++ are very
>>>shocking the first few times you use them, and that it is good to have exposure
>>>to them before you begin programming in "the real world" (whatever that means
>>>;)) However, the goal of learning to program is not so much to learn "the only
>>>language you'll ever need," but more to get comfortable with the concepts of
>>>programming. I agree that in many cases, Java has unnecessary bits that need to
>>>be included for a program to work correctly, but it also is very easy to
>>>troubleshoot, which is something that you would want to have while learning.
>>>
>>>When I learned to swim, my parents didn't just throw me in the pool and say,
>>>okay, start swimming... I would have drowned. You have to take a gradual
>>>approach to learning. The initial classes could be taught in Java, and then,
>>>once a good base is established, other languages could be taught/used. Would you
>>>rather learn GUI programming in Java or MFC?
>>>
>>>Matt
>>
>>QT for linux, of course.  Quite an excellent toolkit.  And teaching beginners
>>Java is pure sillyness.  The classes will always focus on things like
>>polymorphism and oh, isn't it great we can do *this* complicated language
>>feature.  IMHO, everyone should learn assembly first and C second.  After that,
>>its your choice, but at least you understand how your machine works.  Of course,
>>this is the view of a hardware guy <shrug>.
>>
>>anthony
>>
>>P.S. my favorite language is ML, but Zappa is in a mixture of C, C++, and
>>assembly.
>
>I think that's the key... Deciding which language to teach/learn first is
>basically a "religious" issue. I like Java not because of the OO stuff, but
>rather because of the detailed error handling and the lack of memory management
>crud.
>
>Matt

Well I did learn C first.  ML would be a horrible first language. On some level,
all programming languages are equivalent.  With a good enough compiler, your
java, my SML, and vincent's c++ would all generate exactly the same highly
optimized assembly.  But, we don't live in that world (yet).

I dislike Java because I feel it represents the anus of all programming
languages combined.  In a language like C, the designers basically said: "its
your ballgame, tiger".  C is very close to machine language; you have to do
everything yourself.  This means you do a lot of extra work and debug a lot of
silly pointer errors, but you get an extremely fast, efficient program.  You
have the freedom to do anything you want: zero 4 characters at once, access a
pointer as an integer, flip bits anywhere, or anything at all.

In a language like ML, all that freedom is taken from you.  A float is a float.
Everything is strongly typed. What you get in exchange is code that is very easy
to write, because the language is closer to the way we think. (see my glory of
ML post for a few examples).  It also lets the compiler do more optimizations,
because it can make more assumptions about the code.  There is no such thing as
aliasing in ML, for example.

Now, in Java, we have all the crap of C and all the crap of ML in one place.
Java is considerably slower than C.  The JVM uses hundreds of MB of memory.  I
remember seeing a SUN memo telling their programmers not to use Java because of
the huge memory requirements.  At the same time, Java is far less easy to
program than ML.  Programming java is almost the same as programming in C. In
other words: in Java you give up the freedom of C for no particular gain.

anthony



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.