views:

409

answers:

11

Hi all,

i'm looking for project suggestions that would force me to "get my hands dirty" with advanced C++ features. I'm talking about projects that would utilize the full power of the language (STL or even boost (didn't use it much yet)).

Why? Because i want to learn, i want to find new challenges. At work, things start to be boring, really. I was used to constantly encounter new things, new ideas and features. This is most of the time not the case of legacy company code, as you can imagine. And still, looking at some questions and answers here that delve into the depths of templates, shared pointers and all that stuff i happen to find myself lost, not knowing the answer or even worse - not even understanding whats going on.

Thats why i'm looking for something i could code myself, using prefferably only C++ (+ boost perhaps) - a command line utility, no graphics please. And i really do not want no join any opensource community. Looking at code of others is helpful, i know. But thats what i do at work a lot so... no thanks. The project can be anything, meaningful or meaningless, a useful utility or just something made up that has no real usage. The only requirement is, that it would force me to really test my C++ skills. Or at least it should be very difficult or even impossible to code with basic knowledge of C++ - i'm the kind of person who is never satisfied with code that just works, so i believe this will force me to learn. But bear in mind that i'm a working man and my time is limited. So answers like "code your own OS" really wont help much ;)

+1  A: 

Write a forking or multithreaded webserver. Write lisp. Create a database (the whole implmentation, SQL optional).

Byron Whitlock
+1 Yes. Creating some useful and non trivial system based on sound CS knowledge (as the ideas listed above) will help you learn both: your language of choice in real world application and some advanced CS topics. The latter I find much more valuable but the former is worth learning as well.
Tomek Szpakowicz
+6  A: 

What should i code to get into the depths of advanced C++?

  1. Learn more,
  2. learn yet more,
  3. learn even more.

And, no, I'm not joking. Not at all. I started to learn C++ about 15 years ago and I'm still learning new stuff on a regular base.

Have a look at The Definitive C++ Book Guide and List and make your pick.
I'd recommend Modern C++ Design by Andrei Alexandrescu and C++ Templates The Complete Guide by Vandevoorde & Josuttis. These two alone are enough mind-blowing input to keep one programmer getting new ideas for months, if not years. (Note that reading them in this order has the advantage that Andrei's book is thinner and makes you want to read the other one just to fully grok what he writes. Reading them in reverse order has the advantage that you won't get lost as often in Andrei's book. Whatever you prefer.)

sbi
I'd recommend those same two books, but read _C++ Templates_ first (at least the first two sections)... its contents are very useful when reading _Modern C++ Design_.
James McNellis
@James: In fact I was thinking whether I'd recommend in this order or the other way around. I'm not sure, but I'll add a note about this. Thanks for pointing it out.
sbi
+1 Aside from projects, books are a really good source of information. Thanks for suggesting these two. I will take a look at them!
PeterK
@PeterK: To me, for many years now "advanced C++" meant to shift things from run-time to compile time. The main advantage of this from my POV being that, what crashes during compilation, can't explode into a customer's face. So one practical project idea is to create an advanced logging library. Every non-trivial application needs some way of logging things. Therefore, all your future C++ projects will benefit from it....
sbi
...Unfortunately, many of the C++ logging libraries I've seen are deeply entrenched in OO (they often are copies of such libraries in Java and other such languages) and are completely agnostic of C++' compile-time power. (A notable exception found is [templog](http://www.templog.org).) That's too bad, because a logging library is a piece of code that can never be fast enough. Designing your own fast logging library is quite a challenge, allows you to learn a lot ab out advanced C++, and makes for a useful utility in your toolbox.
sbi
+2  A: 

Something like a matrix math library might be along the lines of what you're looking for. Plenty of potential uses of algorithms and containers. It's all been done before mind, but if you're looking for something quick and dirty to try your hand at, that's what I'd go for.

cristobalito
+1 for the "quick and dirty", will consider that as a starting example :)
PeterK
The other plus is that you can always compare your implementation against how others have done it. Just avoid the temptation of looking at other implementations first - have a go yourself and then see how it's been bettered elsewhere. With that in mind, have another go, starting from scratch if necessary. With the example given it should all be relatively small. G'luck.
cristobalito
+1  A: 

Pick any advanced data structure (i.e. tree, priority queue etc.) and implement it.

This way you'll learn how to:
- Design in an OOP fashion
- Provide a useful and consistent API
- Correctly use inheritance, templates, inline functions to fullfill your implementation goals
- Write cross-platform code
- Write comprehensive unit-tests

Use the STL code as a reference to how things should be done.

adamk
How would you use the STL to learn OO design? The STL isn't about Object-oriented Programming at all (inheritance? run-time polymorphism?), it's about _Generic Programming_. If it was OO, all the containers had the same base class which defined abstract methods like `append()` and `sort()`, and you'd could only put descendants of `object` into them. I have seen my share of such library in the 90ies, and I'm very glad Stepanov came and taught us how to do it better.
sbi
+1  A: 

What should i code to get into the depths of advanced C++?

C++ haven't any real advanced characteristic, the language is well done, the advance characteristics are the use of lot of libraries that exists around the world.

from Math libs, graphics, communications, windows/x-windows/kde/gnome, etc.

if you wish learn a mature communication library I suggest the use of The ADAPTIVE Communication Environment (ACE(TM)) that is a little old-fashion but have a really nice bunch of language's advanced concepts.

Have a high learning curve but is use for all mayor companies around the world.

In other hand the avoidance of use a graphic utility is masochist because you loose time in things that any GUI has solve.

You could use Netbeans or Eclipse as multi-platform, KDE Developer for linux (with KDE), MS Visual Studio in Windows, etc.

Gustavo V
volatile is what I'd call advanced characteristic. You don't really have to use it in most program scenarios.
Bruno Brant
@Bruno Not often used != advanced, I very rarely (actually never) use the comma operator, for example, but it's hardly advanced.
anon
Checking out http://www.cs.wustl.edu/~schmidt/PDF/MT-CORBA4.pdf was an enlightening experience on the complexities of synchronized parallel processing and platform-independence
manifest
@Neil: AFAIK, volatile is used to deal with either parallelism/multi-threading or hardware communication. I believe that is advanced.
Bruno Brant
the POCO C++ library made a real nice or weir use of operator comma in the section about database library.http://pocoproject.org/
Gustavo V
+6  A: 

You mentioned creating something like 'a useless utility'. Rather, I would suggest thinking of an application or utility that would be personally of use to you, or perhaps a replacement for an application that you already use that you could design to suit your own requirements, workflows, aesthetics, etc. Pick some particular thing that you want to learn from this project, eg smart pointers, boost, template metaprogramming, regular expressions, multi-threading, networking. Then work out how to implement the application using the selected technology. Wherever there's a bit of coding to do that you know how to do already then stop, and force yourself to think of how to do it in the new idiom. For instance, try writing the application using only smart pointers.

The danger, I find, in creating a silly little demo app is that you don't have any incentive to finish it. Far better to have a goal in mind of a tool that is useful to you. This is exactly what I'm doing myself at the moment: I have a very convoluted workflow for importing photos, tagging them, renaming and editing, so I've set out to write an application in C# and WPF to do this for me. That gives me an impetus to see the project through.

Forcing yourself to solve familiar problems using unfamiliar techniques is a great learning tool.

the_mandrill
+1 I can't see the point in writing code that doesn't solve a real problem, either for yourself or someone else.
anon
A: 

A fairly objective answer: I always thought that the most powerful thing about OO development was polymorphism. And the uses of it are best observed when dealing with Design Patterns.

So, I recommend getting the Design Pattern bible by GoF and writing code that uses it. The application? Can be any, as stated before, because nothing forces you to use any advanced features of anything whatsoever.

(want proof? some of the most complex systems in the world are written in COBOL by people with zero theoretical knowledge in CS)

Bruno Brant
Um I've worked with COBOL programmers, and even written some COBOL myself - their systems are really not all that complex, compared with (say) trading or risk management systems (which are never written in COBOL).
anon
I work with COBOL system. Financial mostly, that deals with risk, with credit and a lot of other stuff. Those systems have huge complexity mostly because they are large, need to perform well with lots of data, and minor mistakes can cause big problems. Maybe our definition of complex is differing.
Bruno Brant
A: 

Try to write fancy memory pool. Surely your hands will get dirty pretty soon. If that would be not enough add garbage collection capabilities ;)

doc
A: 

A C++ profiler tool would make you look at the depths of the language.

Juliano
A: 

I did all the exercises in Stroustrup's The C++ Programming Language: Special Edition over the course of about 6 months. It was worth it.

A: 

The project can be anything, meaningful or meaningless, a useful utility or just something made up that has no real usage.

It's much better to make something useful. You get to use it (and it will make you happier to a degree to use your own application) and you get to share it (open source project - or not).

The only requirement is, that it would force me to really test my C++ skills.

OK, here are some ideas out of the top of my head:

Write a parser for something (expressions, a simple language, XML, logical expressions?). Better yet, write a parser/interpreter for a prolog-like language (you define predicates, objects, and relationships) then make the application perform inference on the given rules to come to a result).

Write a regular expressions package or a regular expression debugger (something where you give a string and a pattern and it tells you up to what point in the pattern the string is matched). When writing a complex regular expression, such an application would be very useful.

Write an XML package for inclusion in boost (hey, you wanted something that would force you to really test your skills).

Write a fuzzy-logic value module with fully supported logical operations (with - let's say - five truth values: false, probably false, unknown, probably true, true).

Write an AI package, allowing you to easily design and implement various neural networks with custom learning/feedback functions.

Or at least it should be very difficult or even impossible to code with basic knowledge of C++

With basic knowledge of C only you can write graphical platforms, operating systems and database management systems, mathematical and cryptography packages and so on (practically anything). There is nothing impossible to code with basic knowledge of C++).

Your imagination really is your limit.

utnapistim