Thread: is C appropriate for intro to computers?

  1. #1
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834

    is C appropriate for intro to computers?

    This comment came up in another thread:
    Quote Originally Posted by lugnut View Post
    It just seems there ought to be a simpler way to do pointer arithmetic. Most of this is just trying to beat the compiler.
    That's so true. I was thinking about posting a little rant in this General section about what I think of the current computer courses, based on the questions and issues people appear to have...

    The sentiment above by a student illustrates this completely. Are students to learn idiosyncrasies of C and get bogged down in it, apparently, or would they be better served to learn algorithms, meticulousness and attention to detail, logic, deductive logic, systematic approaches, and a more generic approach to solving problems using computers? Perhaps C isn't the best tool for introducing programming.

    I'm an oldgeezer/oldtimer.... I was taught programming using BASIC (which was designed to be a teaching tool, coincidentally). In high school we learned how to iterate Pi using series, solve area and volume problems (early methods equivalent to integrals). For example: what's the most efficient ratio of a cylinder to minimize surface area for a given volume - i.e. how would you design a pop can if material costs were all the same for sides or top.

    Language idiosyncrasies were few. If any. Simple IF, PRINT, FOR/NEXT. I don't recall anyone needing remedial help with syntax issues. More likely they were asking about why the results were off... or why one had to convert from degrees to radians.

    C doesn't seem appropriate because too many "pointer" issues, memory allocation, integer vs.. float, plus bracket and indenting distractions miss the point of making computer literate people entirely.

    Maybe it's because we used to call it "computer science" in the mid 70s. Where's the science nowadays in tracking down some segmentation fault or core dump?

    That's my opinion.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I would agree that pointer issues and memory allocation don't belong in a first programming class. I would also doubt that there are many first programming classes out there that get into pointers and memory allocation (except for perhaps learning scanf, but that's not pointers so much as operator&). The students we've seen here (and that we've all seen in real life too, I would guess) who can't process order-of-operations for a formula are going to be equally sunk in BASIC as anything else. (Or those who can't find the big box of source code in their textbook. Or those who can't grasp the flow of a program from top to bottom. Or ... you get the idea.) Would VB be a better learning language than C? I don't know -- I don't really know VB.

    Integer vs. floating-point seems like a pretty important distinction to make, if they're going to use a typed programming language. It helps to get used to limited-precision in floating-point too (I know some CIS faculty here who get really upset at Excel when they type in 0.93 and it ends up being 0.9299999999999999999997).

    (And to be honest, I don't know that that was a student posting -- dealing with data headers and going back and forth with EBCDIC doesn't sound like a typical academic project.)

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Well, the point is that you adapt to the language and not the other way around. This is an issue that will follow throughout their entire careers. They will have to learn the odds and ends of every language they end up using. And no language is without these. So they might be better off understanding programming is not what you see on the movies. This is also, after all, part of the tutorship you should go through during the learning days. Master Yoda would expect no less. And there should never be a reason to make learning how to program any easier of a task. It's my take the wold needs better programmers... like in, real quick before it blows up.

    Instead of fighting against the language rules, the students are better off understanding them and ripping the benefits. On the case of pointers, these are fundamental to a correct understanding of C. And what is at stake is learning how to program, which entails problems. Programming is 99% about frustration. Meanwhile it's true that algorithmic is fundamental, but I'm sure that's covered somewhere else and is no less true that pointers teach of memory allocation, deallocation, code correctness and programming languages pitfalls. A correct and sound understanding of pointers and all the little delicacies around them is, my friend, a big huge gun you are carrying there blazing away at the competition. You might even get laid!

    Seriously though, I find pointers fascinating. Once the student gets to now them a little better, they'll immediately see the power and will not only forgive them, but understand why the complexity. Because power doesn't come cheap. And BASIC... is cheap
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    I don't know if there are many schools that teach C as the very first language for a student? These days I'd imagine Java or VB would be a lot more popular.

    The first language I taught myself is BASIC, and I think that was probably a good thing since I learned about using concepts like IF, FOR & WHILE as well as Functions. Then later when I taught myself C/C++ it wasn't completely alien to me and I could focus more attention to new concepts like pointers.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  5. #5
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    We started with several weeks of just learning what base-2 system is all about. Logic - tables, simple boolean, some rules... then gates (AND, OR), designing adders, comparators, shift registers, counters... all on paper. Then we migrated to the school's computer using BASIC. I think those fundamentals may not be taught today. Else we wouldn't be seeing all those questions about what's binary, and how's all that hex stuff anyways.

    Then later on, post secondary, there were classes in a variety of computer languages for that time...

    Write an equation parser, factoring & simplifying algebraically, and finally write a program to do derivatives algebraically, in SNOBOL.

    Write a simplified airline reservation system in COBOL.

    Write a bucket sort algorithm in LISP.

    Write some sort of simple game such as Xs and Os in PL1.

    Those all seem to me to be pretty sophisticated compared to the "read a movie title and then print it out" stuff I see on the question boards.

    In many ways, computer science was more a field of general excitement and exploration a few decades ago. Now we're stuck with a handful of popularized languages, dictated to us because of market momentum and your company's lock-step lemming mentality.

    Maybe programming is 99&#37; frustration nowadays. But it didn't used to be. I wouldn't have lasted 30 years in this biz if it had.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It depends on what you want to do. I wouldn't argue that what you learned is bad for embedded systems.
    However, for computer software, it's pretty much useless.
    Again, if you're into embedded, C is probably a good choice.
    If you're into computer software, C is a very bad choice. C++, Java, C#, etc would be better candidates.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    I think the focus was more towards an enthusiastic student who says "I wanna get into computers"... so a wide variety of approaches, depth of knowledge (from physical layout of gates to abstract advanced data structures), and several very different languages were thrown at the student.

    With those basics he is well equipped to learn any specialized language for whatever tasks. From interfacing hardware and writing low-level machine language drivers to fixing billing systems and diagnosing graphics library bugs.

    Today the focus is on teaching a very specific language only. And somehow the student is supposed to glean a "general" computer literacy from that. Is that a bad thing? Maybe not if a future job's requirement fits that knowledge perfectly.

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Add it to the list of complaints towards today's programming courses.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Quote Originally Posted by Elysia View Post
    Add it to the list of complaints towards today's programming courses.
    Well, not in Greece. Here the logic is to learn the way of programming than a specific language. That is good, but it requires you to learn by yourself the details of the language.

    If you want to program with OOP then Java and C# are better than C/C++. If you want something without OOP then C is the best. Now, C++ for me has all the features of C and most of the features of Java. In a way if you know C then you could learn C++ for the OOP features and have one language for basic and advance things. From C++ it is really easy to learn Java. The other way around though isn't that simple.
    So in a way, if you want to learn EVERYTHING starting from C and moving on is good. If you don't need the features of C then why bother with C/C++?
    If you want to understand how the computer works and what is the connection with the programming language then C/C++ are essential.

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by C_ntua View Post
    If you want to program with OOP then Java and C# are better than C/C++.
    Better is subjective.
    Java and C# are not necessarily better than C++.

    If you want something without OOP then C is the best.
    Also subjective.
    C isn't quite the world's best language.

    It depends on how you see it...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Every now and again we rehash this subject with a few banalities about how impossible it is to teach CS students, software engineers, what have you. I hope everyone finds out what makes their mornings bright and sunshinie again, because I think we're placing an disproportionate amount of responsibility on ourselves, and language X.
    https://cboard.cprogramming.com/showthread.php?t=105405
    https://cboard.cprogramming.com/showthread.php?t=103387

    Not everyone that visits here have the same goal of styling themselves as "programmer": I'm fairly certain that there is some programming involved in engineering degrees, and few engineers write software. I've long supported focusing on your skills in education because that is what will get you hired. I'm not going to shed any tears because I have to help someone with C on my own time.

    Is C a good language to start learning to program with? Probably not, but at one point we did because the other ones didn't exist, and there is no perfect language to teach to. But, and this might be the only relative thing in this post, I don't think we make enough use of other choices, like pascal. And likewise, I really don't think schools are teaching C first to CS students, but who knows about other disciplines?

  12. #12
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by Elysia View Post
    Also subjective.
    So is this:
    Quote Originally Posted by Elysia View Post
    If you're into computer software, C is a very bad choice.
    So if someone says it's bad for computer software, then it's objective, if someone says it's good for computer software, it's subjective...

    The only objective answer is - try them out and see which fits you best.
    Last edited by maxorator; 10-04-2008 at 08:17 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  13. #13
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It's all subjective!
    I'm simply saying that C is usually not a very good choice for computer software in general. That's not to say you can't or shall not use it. It's up to each and every individual. So long as you know the phrase "use the right tool for the right job."
    Besides, it is my individual crusade to rid the world of C
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #14
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Recently, while reviewing reviews of Accelerated C++, I chanced upon an essay that posits that Learning to Program: It Starts with Procedural (warning: PDF file). One of the conclusions of that essay is that as a first programming language, "for those likely to go on with C++ or Java, the choice is C", though such a first course "can avoid those details of the procedural language rendered obsolete by the modern extensions, e.g. C's memory management and stream I-O functions".

    The author also argues that "C++, in all its size and complexity, is utterly unsuited to learning beginning programming, but its C-like subset is a practical vehicle, especially for those likely to pursue serious full-time programming".
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #15
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    And do you have any thoughts to add to that? Do you agree with the author?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Numeric addresses for computers
    By great in forum C Programming
    Replies: 4
    Last Post: 08-23-2010, 11:53 AM
  2. Computers as authors
    By hk_mp5kpdw in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 11-22-2004, 08:55 PM
  3. Industrial vs home computers
    By nbo10 in forum Tech Board
    Replies: 10
    Last Post: 09-01-2004, 02:04 AM
  4. Matrix and vector operations on computers
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM
  5. Love programming, hate computers
    By PJYelton in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 12-14-2002, 01:04 PM