开发者

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

开发者 https://www.devze.com 2023-01-07 01:53 出处:网络
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 eve

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 encountering 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 what's going on.

That's why I'm looking for something I could code myself, using preferably only C++ (+ boost perhaps) - a command line utility, no graphics please. And I really do not want to join any open source community. Looking at others' code is helpful, I know. But that's 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 m开发者_开发技巧ind that I'm a working man and my time is limited, so answers like "code your own OS" really won't help much.


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.)


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.


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.


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


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.


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


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.


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.


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.


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


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消