Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've been programming C++ for a year now. I've gone through the language features and I've written good programs with it, so I decided to move on to OpenGL. At first it seemed confusing. As I kept going through tutorials it appeared to be easier, but I can't remember the names of classes, methods, arguments, etc.

In fact this doesn't just apply for OpenGL; I often get stuck with other frameworks too. I have a program in my head, I know how it would work, but I cannot remember the names of methods or classes to use.

My question here is, in a nutshell, what techniques can you use to memorize those names? Does writing it over and over help you grasp it?

share|improve this question
1  
What do you mean? A library cannot change C++'s syntax. Or are you talking about memorizing the API, its function names etc.? –  tdammers Aug 26 '12 at 12:38
add comment

3 Answers

up vote 6 down vote accepted

You don't memorize all those names. If the framework or the API is well done, those names will be intuitive.

For example if I want to save a file and I know that there is somewhere a method which does just that, I expect something like File.Save(path, contents). If the API provides it as IOOperations.OverwriteContents(path, new), then I will have hard time finding the method I need, and it probably means that this API sucks, because of a non-conventional, very unclear way of naming things.

Some examples:

  1. I recently tried to use NPOI. I downloaded the library and opened it in Object Browser. The library is full of names like:

    NPOI.POIFS.Dev.POIFSLister.DisplayDirectory(
        NPOI.POIFS.FileSystem.DirectoryNode dir,
        string indent)
    

    Without detailed documentation, I have no idea what is POIFS, what is Dev, what Lister of POIFS is listing, what DisplayDirectory displays and how do I create a NPOI.POIFS.FileSystem.DirectoryNode.

    There is no way to use this library unless you have a few hours to read the documentation.

    The screenshot shows a bunch of unreadable names of assemblies and classes of NPOI library, a good example of worst practices in terms of API

  2. Let's say you want to serialize some XML, and you're pretty sure that .NET Framework has somewhere a method which does just that for you, but you have no idea of its name.

    Among all System. assemblies, System.Xml sounds promising. Let's look inside. Hm. System.Xml.Serialization maybe? Ouch, lots of stuff inside. Let's look for names containing "serializer" or "serialize" inside. Here it is: XmlSerializer, and inside, the Serialize(Stream stream, object o) method.

    Without knowing anything about this assembly before, you achieved to find what you need in a few seconds.

    The screenshot shows the .NET Framework system assemblies. All the names are very clear and explicit.

Remember that to help you finding the classes and methods you need, you have:

  • Documentation. It exists for that.

  • Stack Overflow search and Google. It helps when the API fails to be clear: if you have a hard time finding a method, chances are other people had the same issue.

  • Intellisense (auto-completion).

share|improve this answer
    
Thanks, I thought in order to know a framework very well you had to memorize every name, I understand I am wrong now, and thank-you for the answer. –  Bugster Aug 26 '12 at 13:12
    
I sense some Microsoft bias here... ;) –  tdammers Aug 26 '12 at 18:15
    
I'm talking about "Intellisense". –  tdammers Aug 26 '12 at 18:24
    
After the edit I would +100 this if I could, highly recommended answer! :D –  Bugster Aug 26 '12 at 19:18
add comment

Probably you will never be able to memorize all classes, methods and attributes of all libraries you use because it is simply too much information to keep in your head.

The more you use specific parts of libraries the more familiar and comfortable you will get with them, and eventually you will be able to recall the most used functions/classes without any reference.

However, for less used parts of the libraries you will still have to use reference material as it would be pointless to try to commit whole libraries including all the classes, functions and their attributes to your memory.

So in short:

  • just do more programming with the specific libraries to memorize the commonly used parts.
  • don't waste time to try and hard-learn all whole libraries function after function. Just use the references and you will eventually memorize the material that you use and need the most.

Good luck

share|improve this answer
add comment

If you find it confusing perhaps you can create your own wrapper around the API so you only have to deal with it once. I've never actively gone out to learn off an API.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.