Structure in the flow Structure in the flow
Information overload, learning and personal knowledge management Information overload, learning and personal knowledge management

Posts Tagged ‘homebrew’

Organizing code snippets and programming knowledge

(This post is geared towards programmers.)

This blog is about structuring your personal knowledge. Code snippets and, more generally, programming language information, are interesting in that everyone and their cubicle neighbor seem to have their own approach to organizing them. Here I survey some interesting software and approaches I’ve read about, their features, and present my own method based on my personal wiki.

This post is an example where wiki features come in handy (by opp. to a thorough survey of Code Snippet Management as, err, an academic field of study).

Software and approaches

A code snippet manager is a piece of software which allows you to organize short pieces of code to reuse later. Yet I’m also seeking the ability to integrate general information about the language (explanations, elements of theory, etc.): in my experience, snippets are often examples of a notion I’m learning.

In researching a bit on existing systems, I’ve found a few feature families:

  • Code features
    • Syntax highlighting
    • Management of multiple files (a plus if you want to add entire libs to your snippet database)
    • More specific:
      • automatic indentation on insertion
      • dependency management
      • IDE integration
      • (other noteworthy?)
  • Organization and retrieval features
    • Hierarchical: by language, by functionality/algorithm
    • Tags
      • Tags are particularly useful here (vs pure hierarchical) because I’ll often stumble on situations like:
        • I need a snippet in whatever language for a quick sort algorithm.
        • I need a C++ snippet with an iterator loop.
    • Full-text/regular expression search
      • Regular expressions are especially useful since you often seek specific constructs and regular text indexing won’t cut it.
    • Hyperlinks (well, hallmark of wikis here)
    • Date and other general fields
  • Sharing

There are lots of different approaches and systems. Specialized software exists that allows you to organize your snippet library in a standalone and dedicated manner. Google Snippely is an example:


Screenshot of Google Snippely

A whole bunch of sharewares exist that do similar jobs. Some IDEs come with a snippet manager integrated, as is the case with Visual Studio. Most of these local programs offer a basic outline for organization with more or less search capabilities. If you’re looking for an online version with tagging, check out Snipplr, which, being online, also allows you to share and search others’ submissions.


Snipplr homepage screenshot

In the homebrew solution department, this thread is interesting. Some people talk of filesystem based solutions. A few even use a custom database. Personal wikis (as I use, see bellow) and general outliner software clearly need mention too. For example, this blogger says she uses Microsoft OneNote to organize her snippets.

Getting a bit less personal, it should be noted a quite a few bloggers describe their blog as being a “repository for them to search later”. Therefore blogs and websites somehow count as personal snippet libraries (I did a bit of this with my old me-me-me blog over yonder). These score high on integrating other information (ie. free-form formatted text) with the snippets, and of course on the sharing aspect. Community wikis (ie. not personal) are also a great way to organize and share snippets and knowledge (examples here, here).

As a side note, it’s pretty clear we won’t only rely on our own snippets when coding. “The Web + Google” describes my most often used “system” when searching for coding solutions. Yet there are specialized search engines for this job: Google Code Search (you can use regexps on the whole DB!), Koders, and quite a few more.

My approach

Given earlier posts, this doesn’t need a drum roll introduction: I use my personal wiki to organize my snippets and my programming language learning. Of course, this solution allows for inclusion of formatted text. I admit I have a strong tendency to use my snippets for learning more than for reuse, so that factor might weight more than usual in my choice.

A wiki will allow for many different types of retrieval. For example, using the right combination of plugins, with WikidPad I have hierarchical organization, tags/keywords, full text and regular expression search, and, of course, linking. Most popular wiki systems will have plugins to allow for syntax highlighting, and WikidPad is no exception.


Code snippet screenshot in WikidPad
(using the PrettyCode extension)

Where that solution might be lacking is in the IDE integration department, and in the management of multiple files. In the last case, I have a separate personal code (file system) directory to which I may refer using file:// links.

Speed reading and my RSVP web application

A few days ago I published a JavaScript-based web program, which takes a text as input and flashes groups of words successively. It’s inspired by many other similar programs available on the Web, some free, some not. The technique is called RSVP, for Rapid Serial Visual Presentation. I baptized the program “Faster!” (well, I had to pick a name :) )

<br />
A screenshot of Faster!

Go ahead and try it out. Nothing to download, just click “Play that text”.

In the rest of the post I elaborate on similar software and the effectiveness of speed reading in general.

Comparing it to other available software

One (free & open source) program which has similar features, but more options for rhythm, is Dictator. You must download it though. I created my script to have something approaching that functionality, but available through the web and easy to modify for people who know JavaScript (and, *hrm*, because it made a cute little programming project :P )


Screenshot of Dictator

Other Web versions (see Spreeder and ZAPReader) are nice but lack some features which make Dictator and commercial programs more appealing, notably following the position in the text. Spreeder does have some more advanced rhythm options, though.

There are many commercial programs which offer even more features, such as integration with Office programs. Instead of trying to list them all here, I’ll point you to this comparison table of free and commercial RSVP programs.

I also want to make my version available for integration in other sites (say, for readers to read your blog posts), but I’m waiting for a few interested webmasters to contact me before I take the time to do it.

Why would one use RSVP? and the reality of speed reading

As mentioned briefly in my last post, some people believe this can help increase your reading speed. The idea is to gradually increase the reading speed, the number of words you read in a group, etc. by tweaking parameters in the software as you progress.

Recently, RSVP was also proposed as an alternative way to read on small displays such as cellphones. Some people seem to actually see RSVP as an alternative reading technique rather than simply a way to increase your “normal reading” speed.

My personal experience with the speed reading aspect is that in can indeed help you learn to focus more and reread back less of the text you read a line before. Also, it forces you to decrease subvocalization — hear the text in your head, or even whisper it. I personally never ended the in-head habit completely, though. Phrasal blurbs seem to overlap rather than disappear, if you will.

All these improvements translate in an increased reading speed for some material. They’re basic goals of “classic” speed reading techniques. A good reference for these techniques can be found at Wikibooks.

Speed reading software also has critics; see the bottom of the Wikibooks page.

Types of reading material

If you’re reading some advanced math textbook, taking the time to understand what you’re reading, sentence by sentence, naturally decreases your reading speed. Basically, speed reading is definitely no panacea for Will Hunting your way through a textbook every 30 minutes.

Where it can really help, though, in my experience (and as said by others), is when reading familiar material, say when reading the daily news or reading multiple opinion pieces on a given event.

Speed reading is to be combined with, but not confused with, skimming. Skimming is about not reading at all some parts. Speed reading is about reading faster the whole thing.


If any of you has comments on my application, bugs or suggestions, don’t hesitate to write to me.

Small speed reading JavaScript app

This is a work in progress, but I’ve developped a small speed reading application in JavaScript. It’s definitely not the first of its kind, but I wanted web version with more options. I’m also planning to open source it, and I’ve yet to see an open source web app of this kind.

The app: http://www.fsavard.com/code/speedread/

You simply click “Play that text” and you should grasp the principle real quick.

This is thought by some to increase your reading speed if used consistently. It teaches to not go back while reading, not “subvocalize” (ie. hear the words in your head, or even whisper them as you read) and by displaying more than one word at a time, to read more in one glance.

If you like it and want to come back to it, there’s a bookmarklet in the “About & download” tab that will allow you to select text in any web page and use it as input. Or you can simply copy & paste the text in the text area.

I’ll post something more lengthy on speed reading eventually.