|
| 1 | +## Contributing JRubyArt examples |
| 2 | + |
| 3 | +Share your enthusiasm for coding by submitting an example for inclusion here, provisional versions are acceptable if they demonstrate something interesting (and work), but we would prefer that you followed the style guide. But naturally we expect that you to aspire to the principal of code as art eventually (not many original examples survive without amendment). |
| 4 | + |
| 5 | +### Style guide |
| 6 | + |
| 7 | +* Prefer [bare sketches][bare] over [class wrapped][class]. |
| 8 | +* Prefer `Vec2D` and `Vec3D` to `PVector` (it is confusing and sometimes plain wrong). |
| 9 | +* Prefer `Struct` over `Vec2D` and `Vec3D` if you don't need their methods. |
| 10 | +* No trailing whitespace. |
| 11 | +* Use spaces not tabs. |
| 12 | +* Avoid explicit return statements. |
| 13 | +* Avoid using semicolons. |
| 14 | +* Don't use `self` explicitly anywhere except class methods (`def self.method`) |
| 15 | + and assignments (`self.attribute =`). |
| 16 | +* Prefer `&:method_name` to `{ |item| item.method_name }` for simple method |
| 17 | + calls. |
| 18 | +* Use `CamelCase` for classes and modules, `snake_case` for variables and |
| 19 | + methods, `SCREAMING_SNAKE_CASE` for constants. |
| 20 | +* Use `def self.method`, not `def Class.method` or `class << self`. |
| 21 | +* Use `def` with parentheses when there are arguments. |
| 22 | +* Don't use spaces after required keyword arguments. |
| 23 | +* Use `each`, not `for`, for iteration. |
| 24 | + |
| 25 | +When translating a sketch from vanilla processing (or some other codebase), you should credit the original author, unless the rubified version is unrecognizable from the original. It is often worth running `rubocop` on sketch code to avoid the most egregious errors. |
| 26 | + |
| 27 | +[bare]:http://ruby-processing.github.io/projects/jruby_art/ |
| 28 | +[class]:http://ruby-processing.github.io/projects/jruby_art/ |
0 commit comments