HACKER Q&A
📣 throwawaybbq1

Getting back to C++ and looking for ideas


Hello .. I used to code C/C++ about 15 years ago, and mainly used it for MFC/Windows programming. I spend years doing Java and enjoyed using it for Android development. I since moved to Python for most of my work (mainly working on deep learning). I'd like to get back to C++ again .. I mostly remember the language but need to dust off details like STL, generics, libraries, etc. Here is my problem .. I can't figure out what sort of tiny programs are a strong fit for C++ today. I don't want to build C++ or work with some large existing code base. Best place I can think of where C++ would be a good fit today is Cuda dev. Is there anything else that I am missing? I'm desperately looking for something to get excited about wrt C++ .. would appreciate advice!


  👤 eklitzke Accepted Answer ✓
I was in a similar position to you a few years ago.

My recommendation is to first read Scott Meyer's book "Effective Modern C++". This will give you a tour of the language features in modern C++ without wasting your time teaching you the basics, which are going to come back to you rather quickly anyway. It's a short book and it's not going to cover everything you need to know in modern C++, but you can read it quickly and after you've read it and done a little C++ programming you'll know which things you want to dive into further.

As for what kind of programs to write to get excited about C++, I personally feel like systems programming is the area where C++ really shines, and I would encourage you to find some kind of project in this area that excites you. For example, write a simple high-performance key-value database using mmap. Write a httpd using boost::asio or even just using epoll directly. Something like this. There are a million projects to choose from, just pick something that you find interesting.

With regard to CUDA, while it is true that it's an area where people use C++ today it's also fairly different from writing regular C++ programs since you need to use different tooling and the programming paradigm is a little different. If you're really passionate about CUDA I don't see any reason why you couldn't start there, but I think it would be easier to do regular userspace C++ programming first and then transition into CUDA later if you are interested in it.


👤 saurik
Instead of searching for a project that you would do only to use C++, why not decide on something you would want to build anyway and then build it in C++?

👤 joshbaptiste
https://github.com/SerenityOS/serenity 32bit OS being built in modern C++ by a friendly creator and community who regularly streams on Youtube

👤 monkeybutton
Are there any little devices that you'd like to make or tinker with? C/C++ is still big in the embedded space and that's the first use case that comes to mind for me.

I definitely empathize with your post since I haven't done any C++ in 10 years and I'd like to get back into it. The last job I had using it wasn't on C++11 yet and it seems like there's been a whirlwind of progress since then.


👤 bb88
Personally, when trying to get into a new language, I like to use https://www.projecteuler.net. It's a nifty way to try to use features of a new language. I tried it with go an learned quite a bit about channels and goroutines to optimize solving problems.

The place I see small C++ making gains is in IOT. With https://platformio.org it makes it a breeze to get a compiler to target the platform you want.

ESP32 modules have wifi/bluetooth and are $19 for 3 on Amazon and programmable over usb.

https://www.amazon.com/D-FLIFE-ESP-WROOM-32-Bluetooth-Develo...


👤 criddell
If you've been away for 15 years, then you have a lot of great changes to absorb. I would learn C++20 and not look back.

As far as projects... I probably wouldn't pick C++ for a tiny program.

But if that's what you want to do, maybe check out some of the new coroutine functionality. Some toy async web stuff might be an interesting challenge. There are plenty of services with public REST APIs. Make a toy client in C++.


👤 rsgrn
I did this recently too. You might want to review the language changes from C++11 and C++17.

You could try writing a raytracer, or physics sim, or small tools that would have been difficult/annoying previously (like dealing with JSON). You could revisit writing win32 apps. The WebView2 lib (which is Edge) is self contained-ish and interesting to learn with (lots of async).


👤 stungeye
If you're interested in working with graphics or sounds, I'd recommend checking out openFrameworks, which bills itself as a "creative coding toolkit". https://openframeworks.cc

For a taste of what is possible with openFramworks, take a peek at this youtube series by Lewis Lepton: https://www.youtube.com/watch?v=dwt2NAd1ZYY&list=PL4neAtv21W...


👤 hazard
If you've been using Python for DL, you can try using PyTorch's C++ bindings instead. They're remarkably similar to Python, and depending on what you're doing you may pick up a fair bit of speed. For example if you're doing some kind of RL-like simulation in Python, doing that in C++ will be much faster.

👤 jareklupinski
if you are interested in wireless and the bleeding edge of hardware, Software Defined Radio is a C++ discipline https://github.com/collections/software-defined-radio

👤 abhijat
I have been working on a database engine in C++ by following along with the CMU lectures on youtube recently. It is quite fun and I am getting to learn a lot although I am just tinkering with the storage layer right now.

👤 dvfjsdhgfv
CUDA is a whole new environment and programming paradigm to learn almost from scratch. You can start from the examples and gradually move on to parallel applications from your area of expertise.

👤 stephc_int13
In my opinion, Orthodox C++ is the best and sanest C++ style nowadays, and it is not too difficult to learn.

https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b

I would advise to read the code and tinker with Dear Imgui.

https://github.com/ocornut/imgui


👤 sendbitcoins
You could build some toy projects and compile to .wasm

👤 melenaboija
Distributed computations with new stacks such as gRPC+Protobuff or Flatbuffers

👤 adsharma
Code in python and generate C++. That's my happy place.

👤 lxtx
Rather go with C, or as was pointed out in this thread, Orthodox C++.

Less time being bogged down in the quagmire of C++ "features".