3 ms·
Honestly, just spending time reading through any good code, well-maintained repos, official CTCI solutions, other people's LeetCode/CodeWars solutions, etc. (T
by wnmurphy 5y ago
Honestly, just spending time reading through any good code, well-maintained repos, official CTCI solutions, other people's LeetCode/CodeWars solutions, etc.
(The absolute best way I've found to learn a language's conventions and best practices is to study all of the community solutions on CodeWars)
Then I have a list to which I add any "code tropes" (i.e. using a loop to search a collection and conditionally flip a flag outside of the loop, etc.) or useful patterns (favoring early returns, etc.). This turns into a dictionary of the vocabulary of code that I just keep adding to.
Mainly it's the act of careful, patient reading that unconsciously develops your sense of conventions and ability to visualize abstraction.