Skip to content
Jason R. Clark edited this page May 27, 2015 · 1 revision

The samples directory in the Shoes project is a great way for people to get their feet wet, see what the library is capable of, and make contributions. Because it's a frequently viewed part of the code, we want to take special care in maintaining it.

Types of Apps

Samples can illustrate using Shoes in two primary ways:

  • Basic API usage
  • Full-featured apps

In general, a sample will fall into one of these two categories. Basic API samples will be named with simple- as the prefix, while full apps should get expert-. (nks- samples came originally from Nobody Knows Shoes, a book about Shoes by _why. No more nks samples are expected to be added.)

Style Guidelines

Because samples will be widely read and used by people new to Shoes, we want to keep the code quality as high as possible. As such, please follow these guidelines, in addition to the general practices laid out in the Shoes Style Guide

  • Pass rubocop for all sample code
  • List good samples in samples/README
  • Standard 2 space indentation
  • Comment at the top explaining the sample's purpose is recommended
  • Avoid global variables
  • Avoid class variables
  • Use readable method/variable names (e.g. not a, b etc.)
  • Keep methods short
  • Avoid duplication
  • Use constants for magic numbers, except for explicit element positioning (left/top)
  • If an alternate API exists for functionality (i.e. method to call vs style), definitely use the path less trodden so more of Shoes is shown off via the samples!