+ 2

Better Code?

How does one write "better" or "more efficient" code? I often find myself using basic C++ for tasks that can be simplified or made more efficient with things that I haven't even heard of. Like recently somebody told me about a bunch of ways to make a recent code of mine better, Like using <cctype>. Should I even be relying on google? Edit: This question just bothers me and I'm just gonna narrow it down to "How can I learn to code better?"

22nd Feb 2019, 7:15 PM
Daniel Cooper
Daniel Cooper - avatar
5 odpowiedzi
+ 7
I think a programming language is in several ways like a natural language. For example it has a huge vocabulary of which you'll probably never know - or need - all of it. So basically, besides constantly writing code yourself, you need to 'read' to increase your vocabulary; be that programming books, articles, web tutorials or literally other people's code. Be on a constant watch for unfamiliar patterns that might be useful for you, study them and incorporate them in your own writing. In time, your 'literacy' and skill will naturally increase.
22nd Feb 2019, 8:07 PM
HonFu
HonFu - avatar
+ 4
Standard Template Library.
23rd Feb 2019, 9:55 PM
HonFu
HonFu - avatar
+ 2
With time and experience.
22nd Feb 2019, 8:04 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
23rd Feb 2019, 9:37 PM
Daniel Cooper
Daniel Cooper - avatar