r/AskComputerScience • • Aug 09 '20

Learning higher level programming

Hello

I've been programming for about 5 years now, and I have a decent understanding of several language (mostly C/C++, as well as some assembly and python).

While I do feel that I have a decent knowledge of the detailed, technical stuff (algorithms, data structures, languages and concepts, etc), I'm lacking in the higher level program... design. How do I design and structure larger applications?.
For example, how would I know if I should design something as an object or function? What should I run as separate threads, and how do I figure these things out on my own?

Links or references to informative litterature or articles are highly appreciated, as well as comments!

Thank you in advance.

28 Upvotes

14 comments sorted by

View all comments

0

u/claytonkb Aug 09 '20

Maybe check out System Design. A lot of the topics are oriented toward web infrastructure but they really do generalize. A queue is a queue, whether it is used only inside of an object, used between objects, used between threads/processes or used between systems. So "queue thinking" is an abstract principle of system design. One common use of a queue or buffer is to "decouple" two, asynchronous systems in a producer/consumer relationship so that the producer and consumer can operate on objects at different speeds without freezing the whole system. You can imagine how important such buffers are in multi-threaded system design or any kind of concurrent system.

But there are many such system-design principles, not just queueing. In fact, you can think of the class/interface design within a language such as C++ as an instance of system design! C++ is a system that has been designed to facilitate program design. There is no scientific formula that will tell you, "At this point in the system, you should use a queue." Instead, you must develop your own problem-solving skills so that you become instinctively aware of when you should reach for this or that tool from the system-design toolbox. There is usually more than one viable solution and developing a strong sense of system design will allow you to describe the various tradeoffs between these candidate solutions. Power consumption, latency, throughput, scalability, coupling, reliability, maintainability, etc. These high-level properties are always locked into tradeoffs -- you can have lower latency at the cost of higher power-consumption, or you can have higher throughput at the cost of higher latency, and so on. Identifying the various tradeoffs in the various possible solutions is a key to system design thinking.