r/learnprogramming • u/nullrevolt • 21d ago
Design Patterns
I'm a 5+ year developer who never really studied programming patterns and paradigms. I'm currently tutoring a student in a high-school and I got to thinking about my own programming and design patterns.
When it comes to building an application, in my case one that makes requests, caches the data, and performs some analysis, I'm often considering where it makes the most sense to bind certain functionality and call it from. I'm primarily using an object-oriented paradigm.
Currently I have several threads responsible for calling a number of asynchronous tasks that should:
- Make a web request (retrieving data from an API)
- Potentially make follow up requests
- Cache the response data
- Analyze/Display the most recently cached data
Right now, I have the cache responsible for calling out to the API so that it can retrieve its data to store, but I'm questioning this from an architectural standpoint. It almost seems to me as if the thread or task should have a series of statements more akin to functional programming to control flow.
How would you approach this or recommend a design?