Ok, you win. I am going to pick up Basic Primer Plus and C#Primer plus and also download the express versions of viusal basic and visual c#. Is this a good idea? Are the express versions ok?
Printable View
Ok, you win. I am going to pick up Basic Primer Plus and C#Primer plus and also download the express versions of viusal basic and visual c#. Is this a good idea? Are the express versions ok?
Especially in the case of C#, the express versions are fine.
The express version of C++ is missing MFC, which is only a problem if you depend on MFC.
I'd argue that Visual Basic isn't as attractive. The language syntax isn't nearly as applicable to C++ (as your future intent). It's not as object oriented, as vague a term as that might seem, as C# (or, maybe one might say it, that C# object features are closer to C++ than Visual Basic can be). Even Java is better than Visual Basic, which is 'resembled' in the J# language presented in the visual studio series.
I suppose I should apologize if I've twisted your arm too much ;)
If C++ seemed easy to you, and you've covered pointers and memory management, then you're through some of the tougher parts. It won't hurt to take a tour of C# and see what the praise is all about.
If it sounds like I'm changing my position, it's because I'm on the fence about it, and I have competing arguments in my own mind - though I am personally tied to C++ very strongly.
OK. Lets say I know nothing about programming. What would you recommend starting with? C#? If so, do you know of any good resources for learning it from the bottom-up?
C# may be best, especially if you're targeting Windows.
Some professors consider Java superior, and there's a thread around here were a student told us his professor considers Java the best language ever. The consensus of the members here weren't entirely in agreement :).
Java doesn't produce Windows programs. It produces Java programs. The difference is that 'native' access to Windows isn't possible without resorting to non-standard Java extensions. Still, creating a window, buttons, edit fields, responding to events - it's the same as Windows in theory.
The O'Reilly books on C# get a nod here and there. The web has a bunch of C# tutorials, but you might get more pertinent suggestions in the C# forum.
Please, though, don't blame me if you end up thinking C# wasn't your cup of tea, or if you discover that C++ is different enough that switching is a rude adjustment. It is. Java programmers often have fits degrading C++ when they try it. You might get 'spoiled' by C#, and feel C++ has an awkward flavor to it (because, from that viewpoint, it does).
On the other hand, I genuinely believe that C++ programmers become better at C++ if the try Java or C#, especially if they have a C background. C programmers tend to use C++ as a C with extension, instead of switch entirely to the an object oriented paradigm. C# and Java start with an object oriented paradigm, and give you a comparatively luxurious protection from the details C++ exposes in rather raw form.
However, by being accustomed to strings that automatically expand as needed, with never a pointer wandering off into oblivion, C++ programmers can learn to dispense, forever, with the practices that give C++ a bad image.
For example:
The first version is just a pointer, same as from C. The 'new' is the C++ means of allocating RAM for an object of type SomeObject. It replaces what was once an uglier syntax from CCode:
SomeObject *p = new SomeObject;
SmartPtr<SomeObject> p = new SomeObject;
This assumes that SomeObject isn't a full blown class. malloc wouldn't properly construct a C++ class, with a constructor. The older style struct (which is just a collection of data wrapped into a type) can be made with malloc, but not a C++ object. You can actually write the text and the compiler will accept it, but it may crash. It might work at first, which is worse, because then you move on and develop a crash later, without sensing a direct connection to 'malloc' as the origin of the problem. New C++ students might not even gain introduction to malloc, but old C programmers often have trouble with this 'option' inherent in a language with older roots.Code:
SomeObject *p = (SomeObject *)malloc( sizeof(SomeObject) );
Now, an object created with new eventually must be deleted. If you don't delete it, there's a memory leak. You can create a pointer without allocating space (there are sometimes reasons), but if you use the uninitialized pointer, there's a crash.
The smartpointer version is much better. It will always automatically delete the object when it falls from scope. This offers the C++ programmer some of the benefits inherent in C# and Java. There can even be protection from using the smartpointer uninitialized, depending on how the smartpointer itself is built.
The smartpointer is an example of the kind of thing C++ programmers can take as a positive result of having tried Java or C#. Abandoning the raw pointer is tough for some, but the benefits are powerful, and the reason many prefer Java and C# (neither language has pointers).
Check the C# forum for book recommendations. I'm not a C# programmer, so I have little to offer there. I've 'taken the tour' so to speak, from some online references and examining the examples. I spent more energy on Java when Java was new, and C# wasn't yet conceived. I obtained the same example benefits from that (and, afterwards, I still prefer C++ :) ).
Oh, one final anecdote (no promises though, I got a million). A new member here is 13 (maybe 14 by now). He's studying C++ and win32. This is a monumental challenge for anyone, and it appears he's very determined. I gave him similar suggestions to consider C#, but he wouldn't budge. I must admire that. It's a character trait which just might give him calluses where he needs them, and perhaps I'm saying the suggestion for C# (saying again :) is a weak one. Since he's so young, I thought it more important, be he trudged right on. He's got dozens of threads spawned around here, diving into the deep end. I was expecting him to discover it just too much, and eventually take my advice to switch to C#. The fellow won't even take the advantage of a framework like MFC or WTL. He's diving into win32 - the raw means of making Windows applications in C (or C++). He's progressing well - so he must be banging his head hard against the obstacles. It reminds me of the cliche, "Any puppy worth it's salt will climb out of a box". So, don't take my suggestion of C# too strongly. Universities choose that path quite often, but that may not mean much, either. To me, it makes sense - take the complexity out of the study and you're focused on development. It makes sense for businesses, too. After all that, I have to acknowledge (for what, the 3rd time) I'm hooked on C++, and I have no interest in switching languages.
My best wishes - there's a mountain to climb, but you'll have a fantastic adventure.
I have a theory. My theory is that if you learn the hardest concepts of something first, the rest comes easy. I think I am going to continue to push and struggle through C++. There is a programmer at the place I work (I am a computer technicion) that offered me help if I ever get stuck. Plus I could always get help on these forums. I am just going to take it slow and take my time to hopefully understand everthing. Thanks again for all your help!
In general, I'm a fan of the "For Dummies" books. I haven't had any specific experience with the C++ one though. You might want to try the Bruce Eckel book, "Thinking in C++". It is available as a free download as well as in the bookstores. The site is http://www.mindview.net/Books/TICPP/...ngInCPP2e.html
Whatever you decide, remember (as others here have said) it's a lifelong learning commitment. Stick to it an you can be great. Let technology slide by you and you end up stuck in a niche wondering what happened.
Best of luck,
alan