What computer science class should I take for my math degree? C or C++?

Click For Summary

Discussion Overview

The discussion revolves around the choice of a computer science class for a math degree, specifically whether to take an introductory course in C or C++. Participants explore the implications of each choice, considering factors such as programming complexity, applicability, and the nature of the courses offered.

Discussion Character

  • Debate/contested
  • Exploratory
  • Technical explanation

Main Points Raised

  • Some participants suggest that C is simpler and more suitable for beginners, emphasizing the ease of understanding pointers for someone with a math background.
  • Others argue that C++ might be a better starting point due to its higher-level features and readability, although this is contested.
  • A few participants propose taking both C and C++ sequentially to gain a broader understanding, while others question the necessity of two introductory courses.
  • There is a suggestion that if MATLAB or Fortran classes are available, they might be more beneficial than either C or C++ for fulfilling degree requirements.
  • Some participants express skepticism about the value of introductory programming courses, arguing that they do not provide a true understanding of computer science concepts.
  • Several participants highlight that the specific syllabus of the courses could significantly influence the decision, indicating that course content is more important than the programming language itself.
  • There is disagreement about the complexity of C++ compared to C, with some asserting that C++ is too large for an introductory course, while others believe that the size of the language is irrelevant for beginners.

Areas of Agreement / Disagreement

Participants do not reach a consensus on whether C or C++ is the better choice for an introductory programming course. Multiple competing views remain regarding the complexity, applicability, and value of each language in the context of fulfilling a math degree requirement.

Contextual Notes

Participants express uncertainty about the actual content of the courses, indicating that the effectiveness of either language as a teaching tool may depend heavily on the specific topics covered in the syllabus.

cragar
Messages
2,546
Reaction score
3
I need a computer science class for my math degree.
Should I take intro to C or intro to C++ . I know nothing about programming.
 
Physics news on Phys.org
C. After an intro to C++ you'll barely be able to to anything with it, and it's too complex to even begin to understand. C is simple, and understanding pointers is something a math guy should handle easily.

And, just to be clear, it is unlikely that either one will have anything to do with computer science -- they will be programming classes. If you want to take a class that is actually about computer science, take an introduction to data structures and algorithms.
 
He likely just needs a programming language, I'd honestly advise doing both, C then C++. You won't be that proficient after, but you'll be able to write code that may be beneficial to you. Does your college offer a Matlab out Fortran class by chance, and will those meet the requirements? Then I would advise one those for you instead. Like IGU says though, I wouldn't consider any of those classes real CS, I've done three languages now and still don't understand the behind the scenes of what's happening. After I build my code, run it, It's sort of like magic at that point.

Stacks, how the processor does what it does, ect are still a mystery to me
 
Last edited:
I think we have a math class that uses matlab. should I take intro to c first then c++.
 
cragar said:
I think we have a math class that uses matlab. should I take intro to c first then c++.

I would recommend it if at all possible with your class scheduling, you'll have a much better , perhaps useful, understanding.
 
so take a class that uses matlab, but if that won't work take intro to c first.
 
I question the advice of taking two 'intro' CS courses. The fundamentals for both should be about the same thing. If you're planning to go on to do programming in your life then either one are just a stepping stone and C and C++ should be fairly interchangeable for you at the level that you will be working in the near future. If you're not planning to go on to do more programming then taking to intro CS classes is a waste of time for even more obvious reasons.

I think C++ is better language to begin with, personally. Perhaps that's a matter of taste?

It's hard to recommend a class without seeing a syllabus. Also, all you've said is that you're fulfilling credit. If that's the case, then the choice is fairly inconsequential. In my experience people have an easier time with C++ than C.
 
Last edited:
If you can take multiple of those courses, then C -> C++ would be the obvious answer. However, if your school offers MATLAB or you only want to take one course, then I would recommend MATLAB or C++.
 
ChaseDuncan said:
I question the advice of taking two 'intro' CS courses. The fundamentals for both should be about the same thing. If you're planning to go on to do programming in your life then either one are just a stepping stone and C and C++ should be fairly interchangeable for you at the level that you will be working in the near future. If you're not planning to go on to do more programming then taking to intro CS classes is a waste of time for even more obvious reasons.

I think C++ is better language to begin with, personally. Perhaps that's a matter of taste?

It's hard to recommend a class without seeing a syllabus. Also, all you've said is that you're fulfilling credit. If that's the case, then the choice is fairly inconsequential. In my experience people have an easier time with C++ than C.

Why would people have an easier time with C++ then C? That makes no sense.

The fundamentals for each will be completely different, C will give you the syntax and introduce you to programming languages, an intro to C++ class should focus on classes and OOP.
 
  • #10
Student100 said:
Why would people have an easier time with C++ then C? That makes no sense.
Exactly. I would not recommend C++ as an introductory language. It's just too big. Python is just about perfect for a beginner language, but that apparently isn't an option.
 
  • #11
Student100 said:
Why would people have an easier time with C++ then C? That makes no sense.

The fundamentals for each will be completely different, C will give you the syntax and introduce you to programming languages, an intro to C++ class should focus on classes and OOP.

Because C++ is higher level which makes the code more readable and less cryptic.

I think the important thing to keep in mind here is that we're talking about 'intro' courses not mastery. On an introductory level, OOP is just easier for people to interface with.
 
  • #12
D H said:
Exactly. I would not recommend C++ as an introductory language. It's just too big. Python is just about perfect for a beginner language, but that apparently isn't an option.

I agree with you about Python or even Java but as you said, that's not an option. I'm not really sure about your 'big' statement, however. C is pretty darn big too for someone with no programming experience. I doubt the range of either them will be covered in a significant way in an intro class, thus I can't see how it matters much.

That being said, I'd like to see syllabi. I have strong doubts about classes that are about languages. I'm of the mind that a CS class should be about topics in CS. The language is sort of incidental.
 
Last edited:
  • #13
ChaseDuncan said:
Because C++ is higher level which makes the code more readable and less cryptic.

I think the important thing to keep in mind here is that we're talking about 'intro' courses not mastery. On an introductory level, OOP is just easier for people to interface with.

Errr, I would disagree with everything you wrote.
 
  • #14
ChaseDuncan said:
I agree with you about Python or even Java but as you said, that's not an option. I'm not really sure about your 'big' statement, however. C is pretty darn big too for someone with no programming experience. I doubt the range of either them will be covered in a significant way in an intro class, thus I can't see how it matters much.

That being said, I'd like to see syllabi. I have strong doubts about classes that are about languages. I'm of the mind that a CS class should be about topics in CS. The language is sort of incidental.

His "big" statement is perfectly accurate, even standardization committees take jabs at how large C++ is. C is tiny.

I'm seriously doubting you know what you're talking about at this point.
 
  • #15
Student100 said:
His "big" statement is perfectly accurate, even standardization committees take jabs at how large C++ is. C is tiny.

I'm seriously doubting you know what you're talking about at this point.

You've missed the point. The bigness of C++ relative to C is irrelevant in an introductory course. It's not as if you will explore the entire language -- or anything close to it. Of course, that irrelevance sort of runs both ways. Thus I don't think it matters much if this person takes an intro to C course or an intro to C++. What will matter is the topics that are covered in the course. The language is incidental, as I said. That's also the reason it's entirely pointless to take two intro courses.
 
Last edited:
  • #16
Student100 said:
Errr, I would disagree with everything you wrote.

As you are perfectly entitled to do. Still it is my experience and I believe that's what we're here to share, no?
 
  • #17
ChaseDuncan said:
You've missed the point. The bigness of C++ relative to C is irrelevant in an introductory course. It's not as if you will explore the entire language -- or anything close to it. Of course, that irrelevance sort of runs both ways. Thus I don't think it matters much if this person takes an intro to C course or an intro to C++. What will matter is the topics that are covered in the course. The language is incidental, as I said. That's also the reason it's entirely pointless to take two intro courses.

I'm not talking about the bigness of C++ relative to C. I'm saying C is a tiny language compared to just about any other language you might use. While C++ is a monster of a language compared to any language you might use. This is only relevant because of what you wrote in your past post which I found blatantly wrong.

Of course it matters, if the OP just wants to meet the requirement and C will do that for them, then wham bam you're done. If the OP wants to have a bit better grasp of different programing styles, then taking C++ after will prove useful to them. So I don't understand how you say it's useless to be exposed to procedural programming (C) and then OOP style (C++), just because they're two "intro" courses.
 
  • #18
Student100 said:
Errr, I would disagree with everything you wrote.

Im pretty sure higher level languages make for more readable code for humans. It is pretty much the point of a higher level language to be more readable for humans.
 
  • #19
ChaseDuncan said:
That being said, I'd like to see syllabi. I have strong doubts about classes that are about languages. I'm of the mind that a CS class should be about topics in CS. The language is sort of incidental.
I agree. An introductory CS class should teach how to program (in general) instead of teaching the ins and outs of one specific language. A language is needed to teach how to program, but teaching the language should be a secondary concern.

Since one of the core concepts of computer science is object oriented programming, this should be a part of the very first CS class. In my opinion, of course. Teaching OO techniques with a non-OO language such as C is beyond the scope of a introductory class.

A good introductory language is one that
  1. Is easy to use and easy learn.
  2. Offers a number of different programming paradigms.
  3. Contains a number of computer science data types, built in.
  4. Provides well-established defensive programming mechanisms, many dating back to the early 1960s.
  5. Doesn't carry a lot of arcane baggage.

C fails massively on items 2 and 3. C++ fails somewhat on item 1. Python fails massively on item 4. All have significant shortcomings with item #5. It's not so much a matter of which is better but which is worse.
 
  • #20
D H said:
I agree. An introductory CS class should teach how to program (in general) instead of teaching the ins and outs of one specific language. A language is needed to teach how to program, but teaching the language should be a secondary concern.

Since one of the core concepts of computer science is object oriented programming, this should be a part of the very first CS class. In my opinion, of course. Teaching OO techniques with a non-OO language such as C is beyond the scope of a introductory class.

A good introductory language is one that
  1. Is easy to use and easy learn.
  2. Offers a number of different programming paradigms.
  3. Contains a number of computer science data types, built in.
  4. Provides well-established defensive programming mechanisms, many dating back to the early 1960s.
  5. Doesn't carry a lot of arcane baggage.

C fails massively on items 2 and 3. C++ fails somewhat on item 1. Python fails massively on item 4. All have significant shortcomings with item #5. It's not so much a matter of which is better but which is worse.

C++ isn't too hard to learn with the right resources. Also, I am aware of no language in existence which meets your above criteria. At this point, all languages have there short-comings. An introductory, easy-to-learn language can not be expected to support OOP, imperative and functional programming for example.
 
  • #21
Because C++ is higher level which makes the code more readable and less cryptic.

I think the important thing to keep in mind here is that we're talking about 'intro' courses not mastery. On an introductory level, OOP is just easier for people to interface with.

jesse73 said:
Im pretty sure higher level languages make for more readable code for humans. It is pretty much the point of a higher level language to be more readable for humans.

And when did C become a low level language? C/C++ are both high level languages, it's just that C++ evolved from C by adding some levels of abstraction.

You can equally obfuscate both C and C++ to the point of non-readability, but that isn't the point now is it. Any intro level C code is just as readable as C++ code, if not more so. The whole point is the OP knows nothing about programming. Why throw in OO style when they don’t even understand syntax or what a complier is, or how to put together functioning code.

Learning C before C++ can only help you.

D H said:
I agree. An introductory CS class should teach how to program (in general) instead of teaching the ins and outs of one specific language. A language is needed to teach how to program, but teaching the language should be a secondary concern.

Since one of the core concepts of computer science is object oriented programming, this should be a part of the very first CS class. In my opinion, of course. Teaching OO techniques with a non-OO language such as C is beyond the scope of a introductory class.

A good introductory language is one that
  1. Is easy to use and easy learn.
  2. Offers a number of different programming paradigms.
  3. Contains a number of computer science data types, built in.
  4. Provides well-established defensive programming mechanisms, many dating back to the early 1960s.
  5. Doesn't carry a lot of arcane baggage.

C fails massively on items 2 and 3. C++ fails somewhat on item 1. Python fails massively on item 4. All have significant shortcomings with item #5. It's not so much a matter of which is better but which is worse.
What would you consider the short coming of someone learning procedural programming to get their feet wet before learning OOP?

You definitely shouldn't be trying to teach OOP in C, it's not the easiest thing to do, and C doesn't really support it.
 
Last edited:
  • #22
thanks for the responses, My classes will be intro to c, set theory, and English 101, quite a variety.
 
  • #23
Student, C++ and to some extent C are both considered relatively low-level languages. Learning any language can only help you, and this goes with C before C++ as well. The transition from C -> C++ wouldn't be too difficult. However, C++ can be learned without any background knowledge as well. Cragar, C is becoming more obsolete nowadays. For the most part, you should expect having to learn C++ or another language later in your life. I am not saying C is a bad language - C and C++ are my favorite languages - but the former is becoming less-used nowadays..
 
  • #24
Shivam3013 said:
Student, C++ and to some extent C are both considered relatively low-level languages.

Relatively low-level languages of the higher level languages – if we want to start ordering them –I'll agree, but they're not low level languages.(I would also consider C lower than C++, since C++ has added abstraction, but this ordering of high level languages is kind of silly, and you could ask 100 different computer scientist and you'd get a lot of different opinions.)
 
Last edited:
  • #25
Shivam3013 said:
The transition from C -> C++ wouldn't be too difficult.
I disagree. From my own experience working with others who have never been exposed to object oriented techniques, the transition from C to C++ is extremely difficult. Transitioning from python or smalltalk to C++ is going to be much easier than transitioning from C to C++. As a starter, understanding pointers is an essential part of understanding C. Well-written C++ code does *not* use pointers for the most part. Herb Sutter, the chair of the C++ standards committee, claims to have not used raw pointers (i.e., C-style pointers) for years. From what I can tell, he *hates* raw pointers.
 
  • #26
cragar said:
thanks for the responses, My classes will be intro to c, set theory, and English 101, quite a variety.

Little bit of everything. :approve:

If you can I'd still recommend you squeeze C++ in thereafter, and if you find you like programming and computer science, look into a class called data structures.

D H said:
I disagree. From my own experience working with others who have never been exposed to object oriented techniques, the transition from C to C++ is extremely difficult. Transitioning from python or smalltalk to C++ is going to be much easier than transitioning from C to C++. As a starter, understanding pointers is an essential part of understanding C. Well-written C++ code does *not* use pointers for the most part. Herb Sutter, the chair of the C++ standards committee, claims to have not used raw pointers (i.e., C-style pointers) for years. From what I can tell, he *hates* raw pointers.

I think I wouldn't have been as good in my C++ class without taking C first. I knew *nothing* about computer programming before C; like, I didn't know what an IDE was. It helped me, and the differences between C and C++ in the beginning are very subtle.

Subtle enough it allowed me time to focus on getting OOP.

Just my anecdotal experiences and logic behind it.
 
Last edited:
  • #27
Student100 said:
And when did C become a low level language? C/C++ are both high level languages, it's just that C++ evolved from C by adding some levels of abstraction.
Readability and whether a language is low level or high level language are not defined by binary functions. It is more of a continuous variable where you can rank things as how readable or low level they are.
 
  • #28
D H said:
I disagree. From my own experience working with others who have never been exposed to object oriented techniques, the transition from C to C++ is extremely difficult. Transitioning from python or smalltalk to C++ is going to be much easier than transitioning from C to C++. As a starter, understanding pointers is an essential part of understanding C. Well-written C++ code does *not* use pointers for the most part. Herb Sutter, the chair of the C++ standards committee, claims to have not used raw pointers (i.e., C-style pointers) for years. From what I can tell, he *hates* raw pointers.

The both have their uses but as Bjarne Stroustrup once said about C or C++:
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
 
  • #29
If you understand how state and flow-control works in different kind of computational environments, you will be able to understand a foreign language very quickly as opposed to not knowing the above.

All languages have their own take on the state and flow-control of a program and being able to define these attributes quickly will translate in being able to pick up a language quickly as well (which translates to writing code and getting results quickly).
 
  • #30
Student100 said:
And when did C become a low level language?

It never became one. it was one, right from day one. It was designed as something "better than assembler code", for writing system software and operating systems. For scientific computing, it isn't even as high level as Fortran IV.

C is inherently intertwined with the way computer hardware was designed and built in the 1970s. Specific example - how much of the world population uses a first human language where a sensible representation of a "character" is an 8-bit integer? Apart from the subset of Americans whose first language is not Spanish, of course :smile:

And even if you can squeeze a useful collection of accented western letters into 256 characters rather than 128, don't expect to get sensible results if you try to sort arrays of character strings...
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 21 ·
Replies
21
Views
4K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 4 ·
Replies
4
Views
935