Project ideas to become good at C++ [closed]
I want to get into C++ team at work. Their job is to write CGIs in C++ (mainly but not limited to). I know basic C++. Reading the list at C++ book guide question on SO, I've got three books from a friend (I actually had the first one).
- The C++ Programming Language - Bjarne Stroustrup - for reference
- C++ Templates The Complete Guide - David Vandevoorde / Nicolai M. Josuttis
- Modern C++ Design - Andrei Alexandrescu
I would like to know if there are any projects or ideas you can tell me that I can implement so that I get better at it.
The setup I need. I have a Macbook and a personal crappy Ubuntu dev server machine. I can bootcamp to install any OS if need be.
Can you please also give me some suggestions on how to begin writing CGI (or any tutorial)?
Let me add to your list of reading material; the C++ FAQ Lite is absolutely the best resource for learning the ins and outs of C++. It is useful both as a reference for old timers and as an introduction to beginners. I would strongly recommend reading as much of it as you possibly can, and try small examples that demonstrate each feature mentioned before joining an actual project.
Once you feel somewhat comfortable in the language, then I would recommend taking a look at Github and seeing if there are any C++ projects that are in need of some help. As for the computer generated imagery or the common gateway interface, both of these are language agnostic. These can be written in any programming language, though different programming languages will have different existing libraries for handling them. I suggest you read up on the subject to better understand the standard/algorithms (depending on which of the two you had meant). Once you are more familiar with the subject, you should be in a better position to understand the documentation of relevant libraries.
As for the development environment, I find that Ubuntu is the easiest one to configure, because almost all setup can be reduced to a series of apt-get install
commands. For example:
sudo apt-get install build-essential
Regardless of which OS you use, you will probably want to build and run your code in a predictable, reproduceable environment. I should also point out that the environment that you develop on does not need to be the same as the one on which you actually build and run your code. For example, you could write all your code on Mac OS X, but build and execute your code in a Docker container that is running an Ubuntu instance with your preset, reproduceable build/run configuration.
In terms of resources to implement CGI in C++ (and for other code), please check out the C++ resources page on my website. It lists several tools for networking, computer graphics, and other C++ tasks, as well as general purpose libraries such as Boost and Qt.
The best way to become better at C++ is... writing C++ code. Start with a simple raytracer without any external dependencies (just write output to a PPM file).
- I think this is an interesting enough problem and will let you get started with the language core,
- The lack of dependencies will reduce distractions with potentially complex third-party library idioms which you can't appreciate yet and annoying things like libraries and linking. Plus, you will have less C++ quirks blow up in your face.
Build on that after you have more experience. Go back, refactor your code, add more complex features, third-party libraries (e.g. write a JPEG output, start using bits of boost, like smart pointers).
Rinse, repeat.
answer to the title of the question :) assuming C++03
From Bjarnes website:
1. New learning
2. Principles and Practice Using C++ (Should give ideas about short programs/projects)
3. Learning and teaching C++
And yes, have a good reviewer by your side if you have to learn good C++. Keep a copy of the relevant standard handy (open-std.org)
in my opinion if you make some small project using
- http://www.boost.org/doc/libs/1_41_0/doc/html/thread.html
- http://www.boost.org/doc/libs/1_43_0/libs/spirit/phoenix/doc/html/index.html
- http://www.boost.org/doc/libs/1_43_0/libs/numeric/ublas/doc/index.htm
- http://www.boost.org/doc/libs/1_42_0/doc/html/proto.html
you can get into the advanced C++ topics like expression templates. the project even does not have to do anything useful, as long as you are able to put pieces together to produce some output.
if you know some C++, you can have a lot of fun pushing language to limits with phoenix alone.
as far as ideas, CGI is likely to be heavy in mathematics, try for example writing parallel integration algorithm using expression templates.
for example, you can create syntax like this:
integrate(x*x + sin(x), 0, 100, threads(4));
Read the book 'Effective C++' by Scott Meyers. It's excellent, and will give you good advice on best practices and stuff to avoid.
精彩评论