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.

General OO teaches us to encapsulate and best practices teach us organization. So we end up with re-useable self-documenting code that relieves us of any details regarding implementation.

So, if I need to invoke the windows command line I use my command line class.

class CommandLine
{
   CommandLine(){}
   Invoke(string command) {}
   CloseAsync(){}
   Close Sync(){}
}

Over time these simple encapsulations turn into libraries. We may even have further classifications via Namespaces. This works very well in the same language. Especially when its a language the developer commonly uses.

But, I often run into situations, especially in lesser used languages, where I need to recall a simple common concept that may not actually be a class at all. For example, I don't write a lot of jQuery, but I write enough where I get tired of looking up the proper syntax for $(document).load...or is it

$(document).ready()

or...

$(document).read(function(){});...

This kind of boiler plate code, which I understand well the purpose of, but lack the experience and regular usage of the language to remember the syntax is where my problem lies.

I have seen some developers write a blog to simply remember the idea. My usual approach is...

Google "document load"
GOogle "document load jQuery"
...find some snippet
Google "Document Ready jquery"...done

And this has usually been fine. But, I have also noticed that on SO, some of the top answerers, say Jon Skeet, seem to pull boiler plate answers very quickly...so quickly I wonder if they have built up some sort of reference material to quickly search and slap together this code on the forum, piecemeal or in full.

I would like to use this same concept (if it exists...) to store my "document.ready" snippets so that I may use them for my own coding.

So, does an effecient storage and lookup exist?
What is the best way to store and organize these irregular, but common useful snippets?

Bonus...its even more interesting to note how my coding approach does not lend itself well to white-board interviews (where we have no google, but are expected to write code). How do you handle this issue when facing the "lesser used" languages in your vocubulary?

share|improve this question
    
Understand that there are some people, Jon Skeet for eg. that do in fact know and remember these things. Having written a book on C# and been part of reviewing the spec I believe contributes to the cementing of that knowledge. –  Steve Evers May 5 '11 at 18:22
2  
@SnOrfus - I do understand that Jon and others have and are masters of their domain. I have seen cases where I know the answer to a question, but before I can even finish typing someone such as Jon has a full, well formatted answer laid out. This leads me to question if some people use a storage mechanism of some kind. Not their skill level whatsoever. This is just an aside, I really just want a useful searchable device of my own, that's maybe not Google. –  P.Brian.Mackey May 5 '11 at 18:32
1  
Fair enough. I always assumed that they were just much faster at typing than myself. –  Steve Evers May 5 '11 at 18:38

3 Answers 3

up vote 4 down vote accepted

I've been using TiddlyWiki for a while now to organize random notes. It's portable, self-contained and sort of blog-like.

an open-source single page application wiki. A single HTML file contains CSS, JavaScript, and the content. The content is divided into a series of components, or Tiddlers. A user is encouraged to read a TiddlyWiki by following links rather than sequentially scrolling down the page...

http://upload.wikimedia.org/wikipedia/commons/thumb/9/97/TiddlyWiki_2.1.3_screenshot.png/800px-TiddlyWiki_2.1.3_screenshot.png

share|improve this answer
    
Thats a pretty neat tool. –  P.Brian.Mackey May 6 '11 at 20:23

Personally, I use this newfangled technology called bookmarks. I have a folder on my bookmarks toolbar called programming, and folders within that by language or framework.

As for whiteboard interviews, the secret is that interviewers already know the answers to problems they pose, so you tell them your intention in pseudocode and just ask them about the syntax. "I know there's a jQuery function that gets called once everything is ready, but I have to write it so infrequently that I usually have to google the syntax. Care to remind me of the syntax, or do you get the picture from what I wrote here?"

In fact, when I interview someone I purposefully try to push candidates to that point, because their reaction to reaching the limits of their recall is much more instructive than their reaction to an easier test. After all, our whole job is creating things no one else has done before, including ourselves.

share|improve this answer

Whatever is searchable. I use Evernote with a notebook/folder for different languages. Doesn't matter if I'm at work, using a laptop, smart phone or home computer, the information is right there in an organized and better yet, searchable format.

I've switched to getting electronic books for programming. I can read them in multiple locations and keep them as a reference without dragging around thick books (Which I never do and use to just use Google.).

share|improve this answer
    
+1 for searchability. Also, Spotlight on the Mac is a really easy way to search code; I often need an FB.init() call, for example, and I can just search FB.init( and immediately get what I need from the first result. –  Jimmy Sawczuk May 5 '11 at 18:39

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.