I am a fairly capable Ruby scripter/programmer, but have been feeling pressure to branch out into C++. I haven't been able to find any sites along the lines of "C++ for Ruby Programmers". This site exists for Python (which is quite similar, I know). Does anyone know of a guide that can help me translate my Ruby 'thoughts' into C++?
I don't think that language introductions written specifically for migrants from a certain language have considerable advantage over traditional "independent" introductory books. Reading as a cognitive process has a great feature: reading speed varies greatly. That means that you should take any good C++ book (I'm sure you'll find excellent recommendations here on SO) and your reading speed will be greatly affected by your previous programming knowledge - reading about things you already know will become almost skimming-fast, others will take some time. In the end, you will spend practically the same amount of time as you would if you read a specific migrant course, with the difference of having read a book that you will be able to use as a language reference at any given time in the future, unlike the "transitional guide", which is always kind of "one-time read".
On the other hand, from a perspective of a writer, it's pretty ungrateful to assume (and rely on) such thing as reader's knowledge on a topic. When one says he knows Ruby is it really a guarantee that he knows OOP thoroughly, for example? Or just have been using it not understanding the internals (which is really easy for a Rails programmer, for example).
So a general book is a safe bet both for a writer and a reader. :)
I agree with others. Your skills in Ruby will certainly help you to learn C++ in a way, but they are quite different. A great online book to learn C++ : Thinking in c++
Bruce Eckel's books are a really good start with an adapted learning curve. Simple to begin but going quite deep into the language. Recommended.
my2c
If you want to learn C++, start here.
Once you have learned the fundamentals, you should also look into these:
Effective C++,
More Effective C++,
Effective STL, and
Exceptional C++
Related
I am an undergraduate student and I recently was hired for a co-op for this summer and next fall. From what I understand I will be writing a lot of C++ which I am comfortable with but I don't have a huge amount of experience actually writing C++ in particular.
I wanted to take the time to really dive into C++ and become much more proficient with it. Does anyone have any particular resources that I could use to get some more experience before I start my job?
TopCoder was featured on This Developers Life recently and the algorithm challenges are a great way to hone your skills in various languages including C++
Getting involved in Open Source projects is a regular suggestion.
Good books from many authors are listed conveniently in many places including Amazon.com
To really deeply understand the language and learn some best practices I would recommend to read Herb Sutter's books, in following order:
C++ Coding Standards
Exceptional C++
More Exceptional C++
Exceptional C++ Style
The first one is very useful if you don't have experience with industrial development in C++.
Read The C++ Programming Language by Stroustrup cover to cover, and then read it again and again. Then, as you work with C++ programs, keep referring back to that book to remind yourself of the details of various topics.
It is, by far, the best book on C++ available, and since the author invented C++, you will get a good sense of the intentions and rationales of the various language features.
Once you have mastered the contents of that book, the next step is to familiarise yourself with the C++ 03 and the upcoming 0x standards. Reading a language standard can be hard, but once you get used to the style, standards are invaluable resources.
It is very important to be familiar with the authoritative resources and not get lead astray with possibly incorrect or out-dated information out on the web. I've seen programmers make really dumb mistakes because they just searched on Google to find out how some language feature works.
You need to practice and read manuals (tutorials) for c++.
Else you can try to look at internet website who are not protected and look at the source code.
Everybody work hard for what they learn and apply.
Good luck!
For reasons I will spare you, I have two weeks to learn some C++.
I can learn alone just fine, but I need a good source. I don't think I have time to go through an entire book, and so I need some cliff notes, or possibly specific chapters/specialized resources I need to look up.
I know my Asm/C/C# well, and so anything inherited from C, or any OOP is not needed.
What I do need is some sources on the following subjects(I have a page that specifies what is needed, this is basically it, but I trimmed what I know):
new/delete in C++ (as opposed to C#).
Overloading cin/cout.
Constructor, Destructor and MIL.
Embedded Objects.
References.
Templates.
If you feel some basic C++ concept that is not shared with C/C# is not included on this list, feel free to enter those as well. But the above subjects are the ones I'm supposed to roughly know in two week's time.
Any help would be appreciated, thanks.
Edit: I want to clarify - I don't expect to study for two weeks and then go and write Quake.
I need to get to a level where given some code and a while to think about it, I can understand it. nuances like ++X vs X++ don't matter as much as knowing what the main keywords are, etc.
This site is your best bet. Although its a great reference anyway, the way the questions are phrased and organised you'll be able to get up to speed quicker:
http://www.parashift.com/c++-faq-lite/
I will be honest with you. In 2 weeks, you won't be able to learn the whole C++.
Let me rephrase that, because no one will ever know everything about C++ (it is very huge and yet it's still growing), you won't be able to learn everything you need to become an expert C++ programmer.
However, if you do have some good programming background, many concepts in C++ will sound familiar to you. This will help you learn complex concepts quicker than novice programmers.
I would suggest you to go to C++ FAQ Lite
because it is the site that lists all the main concepts of C++.
Don't expect to program something enterprisy after going through the site, because that ability comes after you have coded some extensive systems in C++. However, the site will definitely help you to understand what C++ looks like and other people deal with in C++.
GOOD LUCK :)
Thinking in C++, Volume II. Free, well written and available online.
http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html
I know you said you didn't want to read a book but "Accelerated C++" is probably what you want. It was actually was used in like a 2 week crash course at Stanford from what I remember to get people up to speed on C++.
If you do not have time to go through an entire book, you may try an online tutorial such as the one at http://www.cplusplus.com/doc/tutorial/.
However, it will be useful to go into more depth about common pitfalls and good practice in C++. A good online resource for this is the C++ FAQ lite, at http://www.parashift.com/c++-faq-lite/ .
If you decide to buy or borrow a book, "Effective C++" by Scott Meyers would be a good choice. You do not need to read it front to back, as each chapter is dedicated to a specific problem you are likely to encounter when writing C++ code, and can be read separately.
If you need quick explanations of specific sections of the language, http://www.learncpp.com/ is also a good resource. The caveat is that their webserver is dog slow most of the time (which is unfortunate, because they have some really good explanations).
I've been doing C++ for 3-4 months in a local college and I'm doing extra reading / learning using Accelerated C++ and so far, I've "finished" it. Now, I'm wondering which book to get next that'll help me code better in C++.
I've looked around and found this: The Definitive C++ Book Guide and List
I'm sorry if this question may seem stupid for most of you here but I'm a bit tight in cash and I would really want to invest in something that's "right" for me at this time.
Right now, I only know the basics of stuff like (classes, templates, STL, iterators, dynamic memory management).
Do you have any suggestions? Should I focus on STL or templates..? Or should I read something like The C++ Programming language?
If you haven't yet read Stroustrup's books, they are definitely a good read. There's nothing quite like reading about the language from the person who designed it.
Whenever I learn a new language, I always try to find the canonical reference material written by the language designer or somebody very close to them.
In addition to reading Stroustrup's books (suggested by another answer here), I'd suggest his two FAQs as a great starting point:
Bjarne Stroustrup's FAQ
C++ Style and Technique FAQ
They both link to further reading material.
These two, along with the C++ FAQ Lite, are required reading for new programmers at my workplace.
Once you're even a bit more comfortable, consider jumping in to the community: subscribe to something like the boost mailinglists, watch the blogs of big name figures like Herb Sutter, read Alexandrescu's Guru of the Week articles. You may feel like you're in over your head (I still do often after many years of reading the lists) but you'll learn a ton, especially watching the language grow and evolve. (And this stuff is free!)
You can get more understanding from watching how a language changes over time, and how people actually use it, than you can from a million hours of memorizing the standard. (Not that shelling out a few bucks to have a copy of the ISO/IEC standard around is a bad idea, mind -- great for reference from time to time.)
As for books:
after the Stroustrup books,
start with the Meyers ("Effective") books.
I'd also recommend C++ Coding Standards -- a great amount of work went into gathering the "common sense" of the users of the language in this book.
Then if you want to blow your mind you can look at Modern C++ Design or some of the fun template metaprogramming resources...
Above all, just stay connected and interested. Mailinglists, blogs, websites, academic papers, magazines, whatever -- choose what suits you best, don't expect to follow everything all the time, but keep your ears and eyes open; find aspects that interest you and follow them!
The C++ Programming Language would give you the best overview of the language. It sounds like you have that but the section on object oriented programming is worthwhile. I'd probably spend more time learning about object oriented programming at this point than more specific C++ features.
A book like "Code Complete" might be a good choice for you.
I feel like you can probably make more progress learning to program by tackling real programming problems, rather than reading another book.
I certainly don't discount the value of books as a programming resource but I do think there is no better way to learn a programming language than writing real code. Given your financial constraints, you have the additional motivation that writing code is free.
Concentrating on a particular part of the language or a pattern for programming might be interesting, but a specific problem to solve will give you context that, in my opinion, is a more powerful learning mechanism.
Of course, you can't write code in a vacuum. You have already read Accelerated C++ which will probably give you more than enough to get started writing code, but there are also a whole pile of resources on the net that will help (StackOverflow is a great place to start).
Tutorials for Win32
Online C resources
VC6 Tutorial
These are my favorite:
Effective C++ - Scott Meyers
C++ Standard Library Tutorial and Reference - Nicolai Josuttis
I might suggest a library card, or hanging out and reading Border's, to make sure the books are helpful for you.
a Good book for templates - C++ Templates by David Vandevoorde, Nicolai M. Josuttis
Learn STL more and more, there is a
lot more to learn.
learn Boost. This would change how
you think about programming in C++.
If you want to go very deep, read Stroustrup's papers. Select a paper now and then, print it, read it carefully. Stroustrup is an excellent writer. reading his papers would make you a superior C++ programmer for sure.
My favorite list is :
A History of C++: 1979-1991, A
History of C++: 1979-1991. After
I read those papers I loved C++.
What is Object-Oriented
Programming?
Why C++ isn't just an
Object-Oriented Programming
Language.
Sixteen Ways to Stack a Cat.
This is a jewel that everyone ought
to read :)
If you don't want to spend money, you should learn multi-threaded programming. The basics are already in the books you have, and described in API documentation. Try to actively create a program with many threads that communicate back and forth, and then multiply the number of threads to see if you've made a good design.
You'll want to read up on Semaphores, Mutexes, and Critical Sections.
I take three approaches to multi-threaded programming:
Use a PostMessage style communication between threads
Pass thread-safe objects between threads through which data is stored and relayed
Initialize a thread on start-up, let it run on its own, and then retrieve the data at the end of the run
If you're ready to spend money, I would recommend Design Patterns as a good next-read. It's more generic, and you'll find some of the ideas make sense.
I think you started out with just the right book! For those who didn't know, this book starts with STL at the beginning and leaves pointers for the end. Most programmers learn C first, and consequently have a forever distorted view of what C++ can be.
It might be really interesting for you to now read 'The C Programming Lanugage' by Kernigan & Richie at this point. This is probably a necessity if you want to understand the mindset behind most C/C++ code in the world today.
But more important than your next programming book is to find a medium-sized program you really want to write, and go after it. Use all kinds of reference materials for the project. Incorporate a boost library or two in your program.
If you are tight on cash, read How to Think Like a Computer Scientist. Also read the FAQ lite.
When learning new languages such as C++ from PHP, does reading other language snippets help you understand better by giving one a different prospective, or does doing so confuse a noob like me? Also, any advice on learning C++ would be great.
I find that reading short snippets helps a lot. A good book is really handy too. Once you understand most of the language itself, reading large, full-size programs helps a lot with learning how common problems are solved in that language. Most languages don't have a term for this, but it is like the "Pythonic" way in Python.
As for learning C++, first get a good understanding of C. C is quite simple, so it shouldn't take that long. Once you know C, start learning about the C++ specific features one at a time. This way, you can still write useful programs (C is mostly a subset of C++), before you learn the real "C++ic" way.
I find it helps to
Get a good grasp of the syntax and semantics of the language, by looking at SIMPLE examples and relating it to something you already know
Look at what libraries and design patterns are common. Find out why they are common. Was the language designed to encourage them? Is it convention? Efficient?
have an idea that you want to implement in the language. It will give you a goal, and some perspective.
Look at other's code, once you are comfortable picking apart and reading it, and comfortable with source-layout, conventions, common-naming and so on
I find it best to dive-in heads first. Get feedback from people if possible. Most importantly:
don't be afraid of making mistakes they are a big part of the learning process. And try and relate things to concepts you are already comfortable with.
If you are sufficiently inexperienced to ask this question, I recommend that you read short snippets, but not in another language. A better mental exercise is to say given a short snippet in the new language (C++), how would it compare with what you would write in the old language you already know (PHP)? Similarly, if you read about a new C++ thing, ask what PHP snippets you could express in the new C++ish way.
Regarding C++ itself, there are plenty of other SO questions to trawl. I think it bears repeating that the Design Patterns book with four authors is very helpful to learn the vocabulary and mindset of many longtime C++ programmers.
I have been learning C++ for three months now and in that time created a number of applications for my company. I consider myself fairly comfortable with C++ / MFC and STL, however I don't just want to be an OK programmer, I want to be a good programmer. I have a few books on best practices but I was wondering if anyone could suggest reading materials that helped them and any disciplines which should be encouraged?
Thanks!
I would start with the Pragmatic Programmer, Code Complete, Refactoring and Design Patterns.
For C++, Scott Meyers books are very good, and will help take you to the next level.
If you don't already have it C++ by Bjarne Stroustrup, 3rd Edition
Uhm... Teach Yourself Programming in Ten Years (Peter Norvig)
3 months into c++ and you're already comfortable with it? Sheesh, I've been learning c# for over a year and have taken numerous Microsoft courses and I'm nowhere near comfortable with it.
That being said, you'll hear Code Complete tossed about as a very good book. I'm in the process of reading it now.
Marshall Cline's C++ FAQ Lite.
Herb Sutter's Exceptional C++.
Large Scale C++ Software Design by John Lakos gives guidance on design methods that will make your C++ more maintainable. It is pretty hefty but you can dip in and still get some benefits.
Somewhat off-topic: rather than suggesting books to learn, I'd like to mention some broad topics to consider.
Threading. This one is not much in demand if you use MFC, but in many other areas it's indispensable. The mechanics of threading APIs are easy to pick up, but learning all the corner cases takes a lot of time and practice.
Closures, Map-Reduce and other lisp-like techniques. Find out what they are, why they are not supported in C++, and how they are imitated in C++ (functors, and many other cases of stateful callback objects). For this I actually have a book: "Structure and Interpretation of Computer Programs".
Command Line. This gives you an idea on when not to code your own programs. Command line would be Unix command line - I don't know about MS's latest experimentation in this are, but cmd.exe is awful. Get Cygwin and start experimenting.
Scripting languages. This gives you an idea on when not program in C++. My favorite is Perl, but many people say Python, Ruby and whatnot. Hey, learn XSLT if you're so inclined!
I am sure I left out other areas. I'll mark this as Community Wiki - feel free to add.
Good blogs:
Guru of the Week, and all the books by Herb Sutter. Those will give you quite a lot to chew already.
Modern C++ Design by Alexandrescu if you want to get a good feel for what you don't yet know, and probably don't want to know.
Code Kata's for practice!
I have read several (not complete but some parts) of oreilly books on VB.net they are quite good, but if you want to be pro and have the time...
You can try out MSDN forums, help other people and discuss with them hard and complex problems, I think it's the best way..
learn another language. even if you won't use it, it's great for mind-opening.
I'd advice Lua, Scheme and Python. but almost anything else would do. (the most different from C, the best)
Josuttis and Vandevoorde - Templates: The Complete Guide
As I see, nobody mentioned Bruce Eckel brilliant books "Thinking in C++". IMHO, it`s one of the best books to start your C++ development from. From my point of view, first volume is more helpful that the second, but both of them worth reading.
http://www.amazon.com/Thinking-C-Introduction-Standard-One/dp/0139798099/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1227890306&sr=8-1
I lot of folks can suggest more modern, up-to-date books. But I still recommend The Annotated C++ Reference Manual by Margaret A. Ellis & Bjarne Stroustrup.
The ARM was published back in '90. It's become somewhat outdated with respect to templates. STL is (obviously) absent. (Though the website at sgi.com does a good job of covering STL!)
However, the ARM is dirt cheap (used). (Shipping will exceed the cost of the book.) Its signal-to-noise ratio remains off the scale. It's very good at digging into C++'s dirty areas, explaining what was done & why.
I still use it as a reference. I rank it up there with K&R.
Dietel/Dietel "How to program C++"... I still have this book on my desk (10 years in).. Every once and a while I re-read a chapter. I'd definatly get the Code Complete, as other have suggested. Infact read that first.
To get a better understanding of object orientation, spend some time in a Smalltalk. Squeak is a free download. Then read Richard P. Gabriel's Patterns of Software and thereafter his Objects have Failed.
Thinking in C++ - Bruce Eckel
Symfonia C++ Standard - Jerzy Grębosz
If you do nothing else, program.
When you are not doing that read about programming and when something strikes you as interesting, go implement something with that knowledge. I've found that this is the only way to really set the principals.
Staying up to date on blogs can be fun, but it is scattered knowledge. It seems to distract more than help. But combined with google and a desire to research something specific can really cough up tons of information. But dont' just subscribe to alot of rss feeds and expect to get better.
I think really studying specific topics helps expand your ability. Research topics that intrigue you, meet people doing things like you (conferences, user groups, irc, facebook, stackoverflow, etc) and above all practice your art.
You can check out the Boost library and a number of the books written about it. While this may not have been what you had in mind, IMO, the Boost libraries are examples of well-designed modern C++ libraries that use the features of the language in pretty much the way they should be used to create among the most effective solutions for their problem domain. Granted of course, there are bizarre libraries like preprocessor and MPL which make you wonder if you'll ever have any use for them, but they're all round quite good. From my own experience, exploring the library and its literature has given me insight into how C++ can be used effectively.
Boost
Beyond the C++ Standard Library: An Introduction to Boost