2015
Good API Documentation
This post provides suggestions on writing good API documentation that targets programmers: how you can document a class, library, or command line utility so that other programmers or power users can make good use of it. Not covered is documentation for end users or GUIs, although some ideas would certainly translate.
Dynamic Programming Exercise
Calculating Binomial Coefficients
Using the recurrence relation , we develop a dynamic programming algorithm to calculate the binomial coefficient. I am aware that better algorithms exist.
An Overview Of The Marpa Parser
There are many exciting parser technologies out there, and one of the most promising is Marpa. This post discusses how Marpa improves over commonly used parsers.
m//gc Style Lexing With Perl
or: Five Parsing Techniques You Can't Do With s/// Substitutions
You are writing a simple lexer or parser in Perl? You'll probably use regexes. Here's how to use the little-known pos() function to correctly apply regexes.
MOPping it up
Building a simple Metaobject-Protocol
Many languages make a distinction between objects and classes. But shouldn't everything – including classes – be an object in a pure object-oriented language? Some languages like Smalltalk, Common Lisp, and Ruby manage just that and offer a complete and flexible Metaobject-Protocol. Others such as Java only offer a read-only object protocol commonly called “introspection” or “reflection”.
In this post, I'll explore how to create a simple Metaobject-Protocol where classes are objects – all without creating infinite loops. We'll be using a previous post's JavaScript object encoding as a basis for this MOP.
Emerging Objects
Building a simple object system out of closures
Object-oriented programming and functional programming imply each other. While encoding closures as objects is a well-known technique (see the command pattern, and e.g. Functors in C++), using closures to implement objects is a bit more unusual.
In this post, I will explore creating a simple object system in JavaScript, using only the functional parts.