Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve example scripts and make them more consistent #59

Open
trych opened this issue Jul 18, 2016 · 0 comments
Open

Improve example scripts and make them more consistent #59

trych opened this issue Jul 18, 2016 · 0 comments

Comments

@trych
Copy link
Contributor

trych commented Jul 18, 2016

As mentioned in #50, I think the example scripts that come with the download bundle could be improved and made more consistent. From own experience I know that these example script are an important learning resource, as they show the methods in question in context.

I suggest the following improvements:

1) Add scripts for each and every method

At the moment there are scripts for some methods, for others not. I think there should be a script for every single method, even if it's trivially simple. Beginners still might need an example for what it does and how to use it.

2) Make the scripts easy, but show the methods in context

So, of course the scripts should generally as easy as possible, yet they should not be mere snippets (see issue #56 for snippets in the docs for that instead) but show a context how the snippets can be used. Example: The b.lerpColor() script does not simply create a single color from two values (which would be the easiest snippet), but uses a loop to create a step based interpolation of colors, so it suggests a context how the b.lerpColor() function can be used. I think this is exactly how it should be done.

3) Add a info block in the beginning of each scripts

There are some scripts that already have a short info (csv.jsx), others don't. I suggest a standardized info block that contains the following infos.

  • Intro sentence "This script demonstrates how to use the b.random() method of basil.js" (also helpful, if the script is moved somewhere else, people can see it stems from basil.js)
  • Explanation of what the script does "The script creates 23 circles of random sizes and places them at random positions on the canvas".
  • (optional) Further explanation how to use the script "Run the script several times to see different results." [or "To use the script you need to have a file example.txt next to your document file.", stuff like that.]
  • (optional) further resources "No idea what CSV is? Then have a read here: http://en.wikipedia.org/wiki/Comma-separated_values"

Anything else I am missing? License maybe?

4) Comments for beginners

I think the scripts should be thoroughly commented, so beginners can understand what is going on. Of course we should not comment every minor detail, but the main logical steps of each script could each get a short, descriptive comment

5) Make the style consistent

Syntax and coding style. I vaguely remember that the style was sometimes inconsistent, but I don't have any specific examples right now. Will have a closer look.

Any comments or other ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants