Qbasicnews.com
June 26, 2019, 07:01:26 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 2 3 [4]
  Print  
Author Topic: C/C++, which one first  (Read 17313 times)
stylin
Ancient QBer
****
Posts: 445


« Reply #45 on: June 07, 2006, 12:49:39 PM »

jofers: why is it a prerequisite to learn C before a higher-level language? IMO, the abstract stuff - that is, the concepts shared by generally all programming languages - is more important than learning the intricacies of C. In other languages, like C++, pointers are less important, but are still used all the time. Any C++ programmer that doesn't know how to use pointers, is the same C programmer that doesn't - it doesn't matter the language used.

More to the point, printf and C-style strings are largely C-specific, but can be used in C++ as well (you just don't typically need to). I fail to see how knowledge of C strings and the C stdlib is a benefit to learning how to think abstractly. If anything, dealing with those kinds of things detract from thinking abstractly.

(I wouldn't put much stock into a programmer that fails to understand how to read the documentation for printf anyway, but that doesn't mean C++, or any other language for that matter, made him/her that way, and I don't think it encourages it, either)

Radical Raccoon: try compiling some *.c files with your VS.
Logged

stylin:
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #46 on: June 07, 2006, 11:27:24 PM »

To me, the more languages you learn the better.
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
NecrosIhsan
Been there, done that
*****
Posts: 1191



« Reply #47 on: June 08, 2006, 02:11:34 AM »

stylin, you missed jofers' point by so far that you'd get frequent flyer miles.
Logged

\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #48 on: June 08, 2006, 04:33:28 AM »

Quote from: "Radical Raccoon"
No, you don't have to know which bit of code you are calling to use it, but to make you're own yes.


You make your own, and then forget about it when using it. It's a must. You can't depend on the implementation. It has to be a black box for you, even if you coded it.

Quote from: "Radical Raccoon"
It's never 100% abstract, because at some level you have to instantiate the first class, then call it's method, etc.


And how isn't that 100% abstract? You just use those functions which are in the interface, i.e. the public symbols exported by the class. That's 100% abstract.

Quote
But aren't you trying to reach the same objective with C? When you code a C procedure don't you want to have it to where the person who is calling it doesn't have to worry about "how" the procedure works, just what it's supppose to takes and what it's suppose to do?


The difference between procedural and OO is simply that in an procedural language the person may or may not use encapsulation and may or may not respect your "rules". In an OO language, it's a must. You can define your class in a way the people who are gonna use it have to do it properly.

If I'm using a library to manipulate lists in C and the person who coded it tells me "You just use the listGet and listPut functions to access the list" ... Well, I can notice that the list is created using an array, and I could address the array directly to save function calls.

If I'm using a library to manipulate lists in Java and the person who coded it defined as "public" just the listGet and listPut methods, I can't do shit with the array Cheesy

That's the difference.

Quote from: "Radical Raccoon"
That's why I liked moving from QB to C++, because I could implement that concept better with an OOP language. Still, it didn't save me (if you suck, you suck). I haven't been able to finish a game in it because I did infact mix the concepts, creating messy and unmanageable code, but I did eventually learn (maybe not perfect yet, but getting there Wink). So if learning C can save you from that hassle, then I guess it's the way to go.


I think we are mixing a couple of conversations together Cheesy We are talking about two different topics in this thread:

1.- Learn C first? My opinion is yes. You learn tons of lo-level stuff which may come handy in the future.

And

2.- Proper OOP: It's more than procedural + classes. That's why I usually bash C++, 'cause I don't find it a good learning language as it allows  "procedural + classes" programs. I mean, on schools they should teach OOP using Java, for example (I'm talking about theory, I mean, teaching Object Oriented Programming - the best language to teach the concepts is not C++).

Learning C is good 'cause you basicly learn how memory works, how variables work, how strings work, how to deal with memory addresses, to manage memory yourself, etcetera. I think that a C++ coder who knows good C can do better. C is almost like "syntax-friendly" assembly. It's like coding in assembly but with readable structure and syntax :lol:

Quote
But the conclusion we've all come to is that learning the proper programming concepts is more important than the language itself.


That's the point. Then it's a matter of learning different syntaxes.

Quote
Since we are speaking of C, where can I find some good compilers for it?  :wtnod:
I have Visual Studio 2003, but that only allows for C++ and C# programs as far as I know.


I like DevC++, it fits me good. It comes with a C and C++ compiler. I find it pretty stable and it's doesn't take over all your HDD like VS Cheesy
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
stylin
Ancient QBer
****
Posts: 445


« Reply #49 on: June 08, 2006, 05:43:32 AM »

Quote from: "na_th_an"
If I'm using a library to manipulate lists in C and the person who coded it tells me "You just use the listGet and listPut functions to access the list" ... Well, I can notice that the list is created using an array, and I could address the array directly to save function calls.

You're assuming the implementation is exposed. If you only had a listCreate that returned some form of handle, you now are forced to use listGet and listPut. Is C bad because it let's you - like C++ - create an 'unsafe' level of encapsulation ?

Quote
2.- Proper OOP: It's more than procedural + classes. That's why I usually bash C++, 'cause I don't find it a good learning language as it allows  "procedural + classes" programs. I mean, on schools they should teach OOP using Java, for example (I'm talking about theory, I mean, teaching Object Oriented Programming - the best language to teach the concepts is not C++).

I would agree that C++ isn't the best language to learn OOP. I didn't learn C++ as a 'C with classes", though, so I cannot relate to your statement. Just because C++ does not embody all that is OOP and allows you to do non-OO things, I fail to see how that is a reason to learn C beforehand. C++ has alot of shortcomings, but - for a beginner - C has alot more that can get you in alot more trouble. (and cause that much more frustration)

Quote
Learning C is good 'cause you basicly learn how memory works, how variables work, how strings work, how to deal with memory addresses, to manage memory yourself, etcetera. I think that a C++ coder who knows good C can do better. C is almost like "syntax-friendly" assembly. It's like coding in assembly but with readable structure and syntax :lol:

As I - and you - have said before, those things are allowed in C++ as well. I don't see how cutting your teeth on pointers in C++ is different than doing it in C. As a student of C++ you realise the procedural/OO/etc. nature of the language. Pointer use may be more prevelant in C, but again, how is that an advantage over C++? Dealing with low-level memory issues just isn't something a beginning programmer should be worrying about, IMO. C forces you to worry about it - C++ let's you worry about it when you're ready. Smiley (I mean ready as in you understand the need for the lower-level access. Moreover, C++ allows you to deal with those memory management issues in a completely OO way. There's no reason to stray from OOP if you're concerned/interested in low-level memory management)

Quote
But the conclusion we've all come to is that learning the proper programming concepts is more important than the language itself.

The argument here, as I understand it, is: What concepts are most important to the beginner? and Between C and C++, which language is better suited to learn those concepts?
Logged

stylin:
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #50 on: June 08, 2006, 05:52:23 AM »

Mixing therms. Read my prev post, we are having two different conversations here which are not related.

1.- Learning C before C++ is good?

and

2.- Proper OOP.

My points fo view:

1.- Yes 'cause it's good to understand how stuff works.
2.- C++ is not good for learning OOP. It's good when you know OOP.

Quote from: "stylin"
You're assuming the implementation is exposed. If you only had a listCreate that returned some form of handle, you now are forced to use listGet and listPut. Is C bad because it let's you - like C++ - create an 'unsafe' level of encapsulation ?


You missed my point. I was trying to explain the main differences between OOP and procedural. Nothing else. And that was just an example. Don't discuss for the sake of it Wink
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
stylin
Ancient QBer
****
Posts: 445


« Reply #51 on: June 08, 2006, 06:19:06 AM »

1. Learning C before C++ is good?
It's good in much the same ways as learning assembler before C. Ie, learning a language is always beneficial, but I don't think there's a need to learn C to be able to get the most out of C++, as I typically use very little from it.

2. Proper OOP.
Program in Java. If you want a bigger toolbox, program in C++.
Logged

stylin:
Radical Raccoon
I hold this place together
*****
Posts: 914



WWW
« Reply #52 on: June 08, 2006, 06:35:36 AM »

Quote from: "stylin"
1. Learning C before C++ is good?
It's good in much the same ways as learning assembler before C. Ie, learning a language is always beneficial, but I don't think there's a need to learn C to be able to get the most out of C++, as I typically use very little from it.

2. Proper OOP.
Program in Java. If you want a bigger toolbox, program in C++.

Or program in C#. C# is much more cleaner and efficient as an OOP language (when compared to C++), and doesn't come with all that excess baggage that you find with C++. I've used both, and C# is way more easier of a programming language to use. But anyways, I've spent enough time on this thread; time for me to move on.

Nathan: Well said and thanks for the compiler info.  Cheesy
Logged

na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #53 on: June 08, 2006, 06:56:14 AM »

C# is Java with C++ syntax :lol:

And VB.NET is Java with VB syntax.

M$ is wise :lol:
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Anonymous
Guest
« Reply #54 on: June 08, 2006, 07:34:36 AM »

Seriously, IMO, learn FB first. It's getting to the point where if you learn it right, you will learn a very clean (option ;p) explicit way of programming. and Lots of concepts carry over. You can use pointers, overloading, zStrings, bit shifts, recursion, typedef, etcetc.

All I know about c and c++ I learned with a foundation of knowledge in FB.
Logged
NecrosIhsan
Been there, done that
*****
Posts: 1191



« Reply #55 on: June 08, 2006, 03:31:09 PM »

Well, it's easy to see who the C++ zealot is in this thread... :laughing:
Logged

\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
Pages: 1 2 3 [4]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!