

Ask HN: Share your tips for mastering API's - apsurd

How do you uncover, learn, understand, and remember all the functions/methods available to you across multiple programming languages?<p>I have a hard time remembering the exact methods/functions I'd need to use to accomplish something. My process is basically live in the google search bar:<p><pre><code>  search: ruby api iterate through hash
  search: mysql create new user
  search: parse yaml file
  search: ubuntu remove directory recursively 
</code></pre>
Because I understand the concepts involved, I get the answers right away, it's just a matter of proper syntax. But this is pretty inefficient in my eyes.
Lest I remember every API I work with, I will continue to require google to remind me.<p>Do you guys have this problem and if so what is your solution?<p>I've never used an IDE but I understand it has auto-completion. 
Doesn't that still require you to memorize the functions specific to a language.
For example say I want to "strip string from end of string" in ruby. For the IDE to help me, I'd still need to start typing str.chomp. However a google search turns up the ruby string docs where I'll be reminded of my friend "chomp". Does an IDE do something else I am not aware of?<p>Thanks!
======
jcrowley
Noting that each tends to have its own standard...

I found a good place to start to remember different computer languages was to
quickly see if the chosen language is case sensitive, and if so are the
methods upper/lower and does this depend on them being static/instance, I know
you already understand this

It follows, check for variations between classes and methods...

eg C#.NET will GetKey, python will get_key, ecma/java/action script will
getKey, VB.NET doesn't give a crap if you GetKey or getKey.. or even GeTkeY...

seeing as all the above (except VB, WTF V'f'n'B!) are case sensitive, so you
can start to guess, this is the stuff you need to memorize right off the bat,
intellisense is often case sensitive and context senstive (static v instance)

I expect you know this, but,

"javascript", id's are often cased Id not ID, but HTML not Html -
document.getElementById('Id').innerHTML

".NET", myDogIsAnInstance.WithAnID, MyDogHasFleas.AndIsStatic()

So you condition yourself, you say, I'm in javascript, that's a lowercase d on
Id, I'm in .NET so the acronyms Html, Dns. not as in JS where they are HTML,
DNS

The answer to the memory/IDE question, yes you still need to use your memory,
but I find intellisense moves the memory task from which method name, to which
bit of the framework/namespace, i.e. in .NET was that Base64 function in
System.String or Convert.ToBase64.. or System.Text...

One of the main reasons to use an IDE is debugging, the ability to set
breakpoints visually and single step though the code, real coders use the
debugger to actually debug, not as a code crutch

IDEs give rise to the concept of projects and structure, and several have
awesome version control plugins. The source code highlighting is 'usually'
heaps better than TextMate/Emacs/Notepad or whatever

IDEs often allow for click navigation to a given class/method (ctrl click)

IDEs often help you find references to/or obsolete bits of code

IDEs often automagically format your code (shitty indentations, tabs v spaces)
this can be viewed as good or bad

IDEs allow for templated solutions, i.e. eclipse can set you up well on the
way to a django google apps project, without any typing, the file/editor based
alternatives involve copy/paste reuse...

Lastly you just practice and get it wrong a lot of times until you remember
and thenyou get it right.

final thing on new programming languages, is it dynamically typed...

oh = "yeah", var oh = "yeah", oh:"yeah"

or strongly typed

string oh = "yeah", oh as string = "yeah"

If you know how the language is meant to behave and learn the suggested naming
conventions for the given language, then remembering the method names becomes
a whole lot easier

~~~
jcrowley
And finally - really, really finally... if a call is hard to remember, wrap it
up in your own method with a better name.

def getNote(): return
some.dark.and.really.obscure.namespace.to.get_one_note_by_googling.for_an_answer_function()

