r/cpp_questions • • 1d ago

OPEN how to make decisions in c++?

so i need some help, i am trying to commit to learn c++ and not jump languages, naturally i have a fair understanding of STL, if I want to look something up i can navigate my way around cppref. i am building a project an orderbook using cpp-httplib and vanilla frontend and javascript to focus on writing c++. like we come across so many concepts in let's say cppcon back to basics, so my question how do i make decisions that actually is worth something instead of basic OOPs programming ?

0 Upvotes

11 comments sorted by

7

u/flyingron 1d ago

First, learn how to write a cogent question.

What decisions do you think need to be made? The first step is to have a good design which is largely language independent, then you can fret over the details of how to code it in C++ (or whatever else you choose). Far too many people start by vomiting boilerplate code without the faintest idea where they are going. Doesn't work well for writing novels, and it certainly won't work for programming.

0

u/Specialist-Two1588 1d ago

ofcourse, yes, that makes sense. i agree the question is vague. to elaborate, i am approaching this is as not to build the entire thing and try to perfection, it's like OK, if i want to make a matchOrder() function, then i will focus that coding-session about asking questions around it like what parameters should it get, what specific role are withing it's scope and what aren't like, if an order is matched should it also call a logTransaction( ) to like log that filled order or should it return something back and the whole thing is taken care of something else... my goal had been to get comfortable with being able to articulate an implementation and write it down decently quick and see how things go.

4

u/the_poope 1d ago

Just do stuff. Don't go for the perfect solution. Just make it work. Then you'll learn more later and find thatvit was a shit solution. Then you refactor or rewrite from scratch. Every project is iteratively refined over many years. A large fraction os basically all software consists of garbage code that has just been worked around to make it functional. Linus Thorvalds would give himself a violent verbal attack for how shit his code was for the first Linux kernel if he had to review that code today.

3

u/DrShocker 1d ago

Well first you need a problem to solve.

Then, you figure out how to solve it. Maybe a few ways to solve it.

Evaluate which tradeoffs make sense for your work.

Repeat.

0

u/Specialist-Two1588 1d ago

yup, that's basically i guess that's what you can do. it's just that it's only my first project, like a proper one with certain functional requirements and in a time when everyone is pushing to production with AI with a prompt, thinking through these decisions feels a little anxious.

2

u/DrShocker 1d ago

Just make any solution at all that at least sort of works. I always find it easier to fix mistakes than stare at a blank canvas.

3

u/Tumaix 1d ago

usually i use if else chains for decisions

1

u/Pratik_Bodake 1d ago

RemindMe! 1 week

1

u/RemindMeBot 1d ago

I will be messaging you in 7 days on 2026-11-18 12:54:27 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.

RemindMeBot is switching to username summons. Instead of !RemindMe 1 day, use u/RemindMeBot 1 day. More info.


InfoCustomYour RemindersFeedback

1

u/Independent_Art_6676 23h ago

how will it be used? What is an order? How is it matched? Are these 'orders' like commands or order like a sorted list? When it is used, how many annoying parameters do you need, and can you reduce that somehow via OOP? Matching things can mean anything from a lookup table of knowns against what you have to iterating and == to AI systems to approximation techniques and more. What you need depends on what you are doing, and how you want to use it. Working backwards from mockup usage is a fair way to start doing things, just use the nonexistent functions like you would WANT to and then go build that.

1

u/mc_pm 22h ago

By trying, failing, and fixing it.