Archived

This topic is now archived and is closed to further replies.

Rob Loach

Why C? What's wrong with C++?

Recommended Posts

I''m in a first year computer programming course at college and we are required to take a course named "Programming in C"... But why? Why not C++? I don''t see why C even still exists with C++ out...... OOP kicks ass. Why not teach us C++ OOP instead? I''m sure they "want us to learn the basics first" but why not learn the basics of C++? I know this will post will probably be flamed to hell, but oh well... I want some answers.... I''ll go in and ask the prof tomorrow too.
- Rob Loach Current Project: Go Through Object-Oriented Programming in C++ by Robert Lafore "Do or do not. There is no try." - Yoda

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Didn''t we already have this thread yesterday?

Share this post


Link to post
Share on other sites
yeah, before posting anything here, read the entire thread here. And then post there, not here.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
bis bis bis bis
NOT MORE C vs C++ THREADS PLEASE!! I HATE IT

I hate that they despise C and praise a language that is practically the same thing, if you like C++, program in C++ but not despising a language with which even we continue programming many people, and with which the same things can be done.

Share this post


Link to post
Share on other sites
Regardless of what type of programming you prefer and which language is ''better'' than others, you shouldn''t limit yourself to a single paradigm of programming. It''s a bad idea to just learn OOP and forget about procedural, functional, relational, and scripting languages. Learn as many ways to look at a problem as possible. You''ll be more versatile and better able to adapt to changes in the industry. By the year 2020, there will probably be something other than object oriented programming that is the most widely used technique. If you put all your eggs in the OO basket, you might be screwed. OOP is not the know all solve all approach to computer science and you''re selling yourself short if it''s all you learn.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
I hate that they despise C and praise a language that is practically the same thing, if you like C++, program in C++ but not despising a language with which even we continue programming many people, and with which the same things can be done.


I don''t "despise" C, I''m just wondering why my course is teaching it when we are moving up to C++ later on in the program.


kdogg - Thanks for the positive insight.



- Rob Loach
Current Project: Go Through Object-Oriented Programming in C++ by Robert Lafore

"Do or do not. There is no try."
- Yoda

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ROB
***
>I''m in a first year computer programming course at college and >we are required to take a course named "Programming in C"...

ya and? where is your problem? i''m at a university and we have to learn c, java, prolog, haskell and a thing thats called sather k.
i only can say, dont think about that and take it as it is

>But why? Why not C++? I don''t see why C even still exists with >C++ out......

have you ever taken a look at the print out of the c++ standard its very very thick *g* and i thinking there is no compiler that implements this standard completely...so to learn c is very much easier, and if you can do c you would be able to learn c++ very fast, or other languages with a similar syntax

and from c to oop programming it isnt a big step
http://ootips.org/oop-in-c.html for example...try google this would give you some more sites

>I''m sure they "want us to learn the basics first" but why not >learn the basics of C++?

so why not learn the basics of c?

>I''ll go in and ask the prof tomorrow too.

ya ask him, he probably would say that u can be happy that you dont have to learn turbo pascal

bye

apo





Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You have the chance to be taught C. If you wanted to take a private course look up how much that would cost. Then see if you begrudge it.

Enjoy learning. Kids have always asked ''why do we need to learn this?'' I guess a good answer is ''because then you''ll know you know it''.

Knowing what C is all about is an important thing in the context of modern programming languages.

Who taught you that ''OOP kicks ass''? Did they tell you that was the whole point? Maybe you should change colleges after all.

Share this post


Link to post
Share on other sites
First of, C++ is much more than just "C with classes", and as it has been mentioned above, its a huge language with many compilers deviating from the standard in interesting ways.

C is a good choice for an (intro) programming course, its simple but still forces you to understand whats actually going on in the computer, which can be good to know when you start using higher level languages like C++, Java or C#. And when you start programming C++, its good to know that you can always fall back on a bit of C code( or i suspect so, i was taught Java,C++,SML in that order so i dont use C code in C++ ).

Share this post


Link to post
Share on other sites
basic of C++:

class MyClass
{
private:
int hello;
public:
int getHello( );
void setHello( int );
};

basic of C:

int myvar = 0;
char* pstring;
void myfunc( myargs );
if else
for loop
do while
switch case
etc...

And as AP pointed out, we learn just about everything in college, from math to physics, from history to philosophy, from BASIC to ASM. they want our money


Programmers are lazy people, they keep trying to find a way of doing so many things without moving.


Current project: A puzzle game. Homework.
% completed: ~10%. ~50%
Status: Active. Active.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Anonymous Poster
and from c to oop programming it isnt a big step
http://ootips.org/oop-in-c.html for example...

Are you using this link to show that OOP in C is simple? I guess you missed this point then:
quote:

However, I would not call it OO. The benefits of OO are primarily based upon polymorphism. And without pointers to functions, dynamic polymorphism is pretty hard to achieve. Unfortunately, in C, pointers to functions are pretty difficult to maintain. /.../ Though this is feasible, my own experience with such complex conventions tells me that they are the first things to be ignored when the schedule gets tight.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Of course oop in c is possible but not easy. Use the appropriate tools (that seems to by python for me a lot of the time, although my work requires my final code to be c++).

Anyway, this is an interesting read <a href="http://www.objectmentor.com/resources/articles/WhyAreYouStillUsingC.pdf">Why are you still using C</a>

Share this post


Link to post
Share on other sites
anonymous
*********

>Are you using this link to show that OOP in C is simple? I >guess you missed this point then:

no this wasnt my intention,

it was only to show that c++ is very more complex than C, i know thats not easy to do oop with c

bye

apo

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Some people prefer C, some prefer C++. Personally I''ve always preferred C, but I''m beginning to use C++ now. It depends really what you want to do, if you''re going to write a massive app C++ is perhaps better as it''s easier to organise your code with it, but if you''re only writing a small - medium sized app why fuck about wasting time with classes?

C++ takes a lot more thought and pre-designing, which is a good thing - for large programs. But if I write myself an engine and want to write a quick file format converter or something the last thing I care about doing is making the code highly organised and object oriented, I just want to get it made and I can do that MUCH quicker with C.

Don''t argue C vs C++ just learn both well and use the best one for the best situation.

Sometimes, you just don''t NEED to waste time with object orientation.

Share this post


Link to post
Share on other sites
OMG why doesn''t anyone understand that you don''t need to write OO code in c++?!? Seriously, how many times do you people need to hear it?

You can write better procedural code in c++ than in c!

Share this post


Link to post
Share on other sites
quote:
Original post by Rob Loach
I''m in a first year computer programming course at college and we are required to take a course named "Programming in C"... But why?

Why don''t you ask them? It''s got nothing to do with us around here. The last thing we need is the mind-numbing tedium of another C vs. C++ thread.
quote:

OOP kicks ass.

You keep saying that, but you obviously don''t know anything about OOP.
quote:

Why not teach us C++ OOP instead?

I dunno... maybe OOP doesn''t kick ass after all?

Share this post


Link to post
Share on other sites
Here is some good reasons i can think of:

1.Generally C is faster than C++
2.All that OOP can really eat your head(believe me)
3.You can port C to C++ easily but the back is EXTREMELY hard

The PAIN is coming...this summer!!!In cinemas everywhere.

Share this post


Link to post
Share on other sites
quote:
Original post by Rob Loach
I''m in a first year computer programming course at college and we are required to take a course named "Programming in C"... But why? Why not C++? I don''t see why C even still exists with C++ out......

OOP kicks ass. Why not teach us C++ OOP instead?

I''m sure they "want us to learn the basics first" but why not learn the basics of C++?




because most of the C/C++ courses/tutorials do it that way (which i think is good). the C course shows the basic programming concepts, while the C++ course is usually more about software engineering,all about OOP,directed towards business applications (you surely know the typical examples, "class BankAccount", "class Customer").

in my opinion it''s good to have a seperate C course, C is a compact language and most of the skills you earned are directly comparable to many other programming languages, while C++ features like templates or virtual inhertiance are very specific things.

Share this post


Link to post
Share on other sites
Let''s face it: some people code in C, some code in C++. Some code in a little bit of both. Does it matter? If it''s for a personal project you''re working on, why worry about coding in a "better" language if you feel more comfortable with the language that others consider a little worse?

And besides, many of the constructs in C++ are also present in C. Why not start from the ground up instead of leaping ahead? OOP is strong and allows for a lot of flexible, readable code, but it isn''t god.

Share this post


Link to post
Share on other sites
quote:
Let''s face it: some people code in C, some code in C++. Some code in a little bit of both. Does it matter? If it''s for a personal project you''re working on, why worry about coding in a "better" language if you feel more comfortable with the language that others consider a little worse?



If you''re doing it for yourself, choose the language that best fits the job.

If you''re doing it for money you''ll have to use whatever you''re told to use; if that''s C then you''re going to have to know your stuff. I''d try to persuade my employer that the language which best fits the job is more appropriate. It quite possibly could be python (c; but you''ll have to know the pros and cons.

Learn C. Learn C++. Learn Python. Learn Java. Learn Ruby. Learn Haskel. Learn Lisp.

Use whichever one is appropriate if you can.

Share this post


Link to post
Share on other sites
I think a good reason for C to be taugh first is that people often go "OO-Crazy" when they have classes at their disposal. Teaching C first helps the students understand procedural programming without tempting them to be "overly OO". While it is possible to use OO techniques in C(and to not use them in C++), people apparently don''t think that way when using that language.

Share this post


Link to post
Share on other sites
There''s overlap between functional and relational. I meant functional to mean things like lisp, which i don''t consider relational. I added relational just to beef up the list, and was refering to DB languages, such as SQL. I also could''ve put in logical, as in prolog, but forgot.

Share this post


Link to post
Share on other sites