by Felz · 7y ago · 0 comments
I'm doing a lot of Kotlin right now, where simple, useful extension functions are an autocomplete away. I don't need to memorize how to get a slice of an array; I know it's going to be named something like .slice(), and I can jump right to the documentation from my IDE.
When I run into something not in the standard library, I write a little extension function of my own. And then I remember it the next time I run into that problem, and get to reuse it, just like it were part of the language.
For any programming language, I consider the following pretty essential APIs that you are going to use over and over:
1. Details of primitives and built-in "base" objects and related functions (e.g. strings, numbers, object literals, dates, etc.) 2. Collection libraries (arrays, dictionaries, sets, etc.) 3. Details of async libraries (e.g. in JS everything in Promise, how that applies to async/await). 4. Streaming libraries. 5. For OO languages, details around class creation/construction 6. Language specific details that are important (e.g. for Javascript I would put things like which values are falsy, Function prototype values like apply, bind, etc.) 7. Default common 'util' libraries, like lodash for JS and Apache commons for Java (not necessarily saying you know every single function, but you generally know which functionality groups are there).
Yes, you can look those up, but if you have a good memory for what the slice() function is and what you can do with it you will be faster than someone who has to look up the details every time you want to use it. In addition, knowing the general API surface means you know instantly what tools are available to you vs. what you'll need to create or get from an alternate library.
'CPU-bound' I would say is where you have all the pieces you need to solve a problem, but the precise solution is tricksy or math-heavy. Such problems are relatively rare in day-to-day programming. So I would say that on the contary, most programmers are I/O bound most of the time.
More time should be spent thinking than typing; specifically, reasoning through the problem domain and appropriate solutions. Having surface APIs memorized is going to save less time than having a well of experience to draw upon thinking through correct or best solutions.
Beyond that, you identified a ton of areas of APIs that are useful to know, but if you understand the fundamentals behind the ideas (i.e. how to use arrays to solve problems, when to get a subset from them, how promises and futures differ from streams, etc) you're 90% of the way there. I think it's less about memorizing the API specific words and knowing the language of the paradigm.
I might be splitting hairs a bit on that last point, since they're pretty closely related. But, I think a 10x developer is going to be better distinguished by knowing when to use a future vs. a stream, rather than simply knowing the API method names and signatures for a particular library / language.
Every time I need to write something in a new language, I grok it and write on it with a handy syntax /API/SDK reference.
For me, The things worth remembering are the patterns used to solve stuff, not how the patterns are implemented in a specific language
I do follow the same approach.
As Nicklaus Worth stated, knowing algorithms and data structures is more relevant as specific language features.
no-clobber
note: existing files or objects at the
destination are not overwritten, and are
reported as being skipped.
note: makes an extra GET request before
uploading an item. this may adversely
impact small transfers, or save data if
large transfers can be avoided.
For the second example I'd simply adjust the code sample as: var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var citrus = /* ??? */;
with only the `fruits.slice(1, 3);` part on the answer side.Now, math equations or the minute details of data structures and algorithms.. Those can be hard to internalize and knowing them well is very helpful when reading papers or other diving into open source projects which make critical use of advanced, specialized knowledge.
Some interviews, maybe. As you say, it doesn't matter much for day-to-day work -- and so I put no weight on it when rating interviews either. If the candidate remembers the right method names, great. If they don't, who cares.
I always make a point of explaining that I'm not testing them on API memorization.
I have never actually gotten a job where the interview had a variation of that question.
on edit: changed explain to exclaim, don't think it significantly changed the meaning in context however.
I also give a problem that doesn't use a lot of library functions.
At this point I can sit down and bang out entire Ansible roles (hundreds of lines of YAML) without having to reference the docs or even use auto-complete for 95% of it. It's really a joy when you can just focus on getting what you want down in code and have it work in the end -- without interruption.
I'm with the author here in that I am very jealous of anyone who can memorize things like that without putting in years of practice. It's not just a speed boost, but you feel good about yourself being able to just hack on something for 20 minutes without having to look a single thing up. It takes a LOT of repetition for me to get to that point.