this post was submitted on 13 Jun 2024
29 points (100.0% liked)
Learn Programming
1625 readers
1 users here now
Posting Etiquette
-
Ask the main part of your question in the title. This should be concise but informative.
-
Provide everything up front. Don't make people fish for more details in the comments. Provide background information and examples.
-
Be present for follow up questions. Don't ask for help and run away. Stick around to answer questions and provide more details.
-
Ask about the problem you're trying to solve. Don't focus too much on debugging your exact solution, as you may be going down the wrong path. Include as much information as you can about what you ultimately are trying to achieve. See more on this here: https://xyproblem.info/
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Some of this is probably just getting to know your tools. Learn the language, look at others' code and interrogate what they did and why. The higher-order functions (scary-sounding term, but they're not actually scary) you mentioned are useful, go learn them and use them.
Some of it might also be (I haven't seen your code) getting a better understanding of the problem you're trying to solve. Figure out what all the separate pieces you need are, and then break those pieces into their pieces and so on, until you've got simple, self-contained chunks of functionality that you can give simple names to. Some of those might be functions, or you may find that they're simple enough that they don't need to be. Refactor and think about how to make the problem simpler. I think a lot of it is just staring at your work and dreaming of ways the make it simpler and easier to read.
If you really want to optimize for performance, that can come later once you really have a feel for it.