Re: Another Newbie Question: C or C++
I need to buy a book on C or C++ to help me in FreeBSD. Which would be better to buy? I first thought a book on C would be best, because the OS is written in C. But, now I'm not sure because I read that gcc can compile C++ too (so, I'm assuming C++ must get used too). I can recommend Who's afraid of C++? by Steve Heller. It's good as the very first programming book to read, very easy to understand. I would recommend not trying to learn C or C++ by yourself from a book. The fastest (and best way) to learn the right stuff is to take coursework from a university or community college. If the courses are any good, you'll get feedback, and you'll be paced and challenged with projects designed to help you learn. Going it alone in an unguided environment will only familiarize you the lesser aspects of a language, if you last that long. The difficult and most important aspects of the language (like pointers, virtual functions, references) will become almost insurmountable trial-and-error obstacles if you try to teach yourself. For example, pointers, found both in C and C++ are a very hard thing to learn the first time around. You msy find yourself buying book after book, looking for explanations when you really should be learning in a guided environment where you clarify things with other people. If you try to teach yourself, you won't get proper exposure to good programming practices and the software development process, such as planning and documentation, modularization, good interface design, commenting code, using the debugger, writing good tests, etc. This knowlege is more important to effective programming than learning the mechanics, and distinguish professionals from cheap hacks. Take coursework!! --Allan ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Another Newbie Question: C or C++
A decent school will start you with C as an introduction to programming then teach you basic C++ (you write your own abstract data types). On Tue, Nov 11, 2003 at 8:17pm alexander v p [EMAIL PROTECTED] wrote: if i've got the msg, it seems u're sugesting to go to software uni and finish that instead c/c++ advice @ the end. Yes, I would suggest doing that. I would suggest a writing course too. back to the ?, i would go with C for starters. C++ later. alone, with books, lotsa {coffee|oj|pepsi|...|..} and good luck. coursework can help if you have time/money. $0.0153 alex p.s. ESL For a teach-yourself strategy that sounds reasonable. Just remember that studying from computer books costs time and money too. IMHO, after all is said and done, the cost is the same, but you will profit more if you take a class. Good luck with your efforts! --Allan ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Newbie: The C / C++ Issue
Am I missing something here? When does C have OO capability? Structs don't count. What about inheritance and polymorphism? That's in the implementation AND application. Just because you CAN access part of a lowly struct, doesn't mean you have to. It's object oriented if you OBSERVE the restricted accesses defined by OO. Whether or not they're there is completely irrelevant. Of course C has OO capability, it just doesn't have its restrictions :) The idea that C can be used to do object-oriented programming is a myth. The C language is not object-oriented or even object-based. The big reason C++ is object-oriented is due to dynamic binding. Check out the C++ FAQ lite: http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.8 If you declare a struct, and then implement a specific set of routines to manipulate it, and only use those routines, except for those 'data members' that would otherwise be public anyway, that's essentially your class. You're doing without all the type and access restrictions IMPOSED by C++, but that doesn't mean you can't OBSERVE those restrictions. This way, when saving cpu time is critical, you can bend those rules. With C++, you're stuck on the long road. You can drive your car to an open plain in the desert, and operate the vehicle as if you were in the city, observing imaginary stop lights, lanes and traffic. But why pretend? The systematic constraints in C++ exist to organize code, protect your work. They are there for the same basic reasons that local variables exist in C. I would agree that you can write programs that do the same thing in all three languages above, but I don't think that OO is a waste of time. OO promotes code reuse. That is the whole point. No one ever claimed OO was a waste of time that I noticed. But I don't see code reuse with C++ any more than with C. I'm a real big fan of code reuse, and I have reused more C code than I can remember. Problem is that when C++ code gets reused, it's usually a template class, in which case, you'd probably be better off with C anyway. There are so many different ways to re-use code. Even cutting and pasting, which is essentially what the STL does. (correct me if I am wrong) If you are going to re-use code, at least be organized, make a good interface, and don't re-invent the wheel unless you have to. C, C++, whatever. Using C++ implies a state of mind. You can write code like in C, but it defeats the purpose of using an OO language. Not sure what you mean by this, but if using C++ is a state of mind, why can't that state of mind affect the way C code is written? And it doesn't defeat the purpose if you misbehave regularly and NEED the unbreakable restrictions. Components in the real-world problem map directly to objects in the program. C++ was designed to be used this way. C was not. --Allan ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]