Factor/Coding Style

Source files

Tabs are not allowed in Factor source files; use four spaces instead.

Try to limit lines to 64 characters, except for documentation, which can be any length.

Most word definitions should fit in three or fewer 64-column lines.

Short definitions can be on one line, while longer ones should be split up over several lines.

Words definitions should fit on one to three lines if possible, with the exception of words that use case and cond or literals. If the words are aptly named and definitions kept short, your code will be mostly self-documenting.

Instead of excessively long comments, favor readable word names and use the Help system for longer explanations of how words work.

Code

Factor words should be named-with-dashes instead_of_underscores or CamelCase.

Any copy/pasted code should be factored out into new words.

Use combinators to abstract control flow patterns.

Use library words where possible.

More general words should go at the top of a file; more specific at the bottom.

Try to use collections instead of working with individual objects on the stack.

Don't use the datastack as a data structure.

Use meaningful word names. Avoid too many words named (foo) or foo*.

A word named (foo) should only exist to help implement the word foo.

Come to the IRC channel and we'll review your code. It's fun!

This revision created on Wed, 2 Nov 2011 12:33:12 by theom (Modify the name of the IRC channel link)