Friendly names for Processing Sketches like the p5.js web editor

Hi everyone!

I heard of Processing through Daniel Shiffman’s videos, and while I do not use it personally, I feel the it is a great tool for teaching and creative coding. I would love to contribute to the development of Processing.

The first thing that I would like to contribute is a better naming scheme for new sketches. I personally feel that the way new sketches are named is horribly boring and difficult to read.
The p5.js web editor uses the Glitch friendly word list to generate random, fun names for new sketches. I have replicated the behaviour in the Processing IDE.

Now, how do I get it accepted into the main branch? Should I just submit a PR? I did read the Contributing Guidelines, but that was not of much help.

Thanks for your time.

2 Likes

I see what you’re saying, but on the other hand Processing sketches are named after today’s date. I’m sure at least a few folks find this naming convention more useful than randomly-generated names. I also wouldn’t be surprised if certain tools and libraries depended on this naming convention.

Not saying you shouldn’t contribute your change, but I think you’d probably want to make it a setting that people could choose.

2 Likes

I was worried about that.

That is a good solution. Should I start working on it? My Swing is a little rusty, so might take a while.

Can you post a link for the list of friendly words?

The original list is here:

I combined the lists into one Java class along with a few helper functions:

//Words from the Glich list of friendly words.
//Link: https://github.com/glitchdotcom/friendly-words

package processing.app;

public final class FriendlyWords {  
  static public String generateProjectName() {
    String adj = predicates[Math.random() * predicates.length];
    String obj = objects[Math.random() * objects.length];
    
    return capitalizeFirstLetter(adj) + capitalizeFirstLetter(obj);
  }
  
  
  static public String generateCollectionName() {
    String adj = predicates[Math.random() * predicates.length];
    
    return "My " + capitalizeFirstLetter(adj) + " collection";
  }
  
  
  static private String capitalizeFirstLetter(String s) {
    return Character.toUpperCase(s.charAt(0)) + s.substring(1);
  }
  
  
  public static final String[]
    collections = {
      "accrual",
      "aggregation",
      "album",
      "analects",
      "anthology"
	  //...
    }
3 Likes

Thank you so much!

Chrisir

You’re welcome :smile:.

1 Like

Hi @KartikSoneji – have you opened an issue on the Processing github repo proposing that you work on a PR? This sounds like something that would be up to benfry – you might get good feedback, and you might also be suggested to move it to a PR on Processing4 instead of 3.

I think as an option it sounds like a great idea. Currently:

sketch_200520b

…I would imagine the options might be:

sketch_iridescent_turnip_200520b
sketch_iridescent_turnip
iridescent_turnip_200520b
iridescent_turnip

No strong opinions, but I can see reasons to prefer different approaches, depending on the goals.

Hi @jeremydouglass !

I have just opened a PR.
The Fork with my code is here.

Right now, I have the naming as: IridescentTurnip. If you enable the “Use Old naming scheme for new Sketches” setting in Preferences, it defaults to sketch_200520b. Please let me know if you have any suggestions.

1 Like

Sounds like a good idea but you should name the switch for friendly and not-friendly names differently because especially new users won’t know what is meant by “old naming scheme”.
Maybe name it “Use alphanumeric scheme for new sketches”.

1 Like

Hi @Bobby54,

You are right, perhaps “Old naming scheme” is not very clear.

Technically, “alphanumeric” means comprised of Alphabets and Numbers, so the name iridescent_turnip_200520b also qualifies as alphanumeric.

Maybe something like:
Use Old naming scheme for new Sketches (Eg: sketch_200520b)
OR
Use Old naming scheme for new Sketches (Eg: sketch_{yy}{mm}{dd}a)
will be better?

Hi @KartikSoneji,

alphanumeric probably wasn’t the best term for it but I like your second example.

1 Like

What do you think, @jeremydouglass ?

Maybe a dropdown, like “Language:”

Default sketch naming: Dates (sketch_201231)
                       Friendly (IridescentTurnip)
                       Friendly dates (IridescentTurnip_201231)

@jeremydouglass, @Bobby54 How is this?

I have also updated my GitHub branch.

2 Likes

I would say that this is perfect. Great idea to use a drop-down menu and show example names behind it.

2 Likes

Awesome.

One suggestion. The issue that you opened – that I’m assuming you will submit a PR to close – says “New sketches are a mix of numbers that need to be read VERY carefully.”

It might be good to edit the issue description to something like “New sketches are named with a number date string, sketch_201231b. This mix of numbers can make it hard to distinguish sketches.”

I suggest this because Ben might get the misimpression from your description that you wrongly think the sketches are named at random – and then discount your issue as a misunderstanding.

2 Likes

Thanks! I still need to work on language support, should submit a PR by tomorrow.

To be honest, I only recently found out that the numbers at the end of sketch names are NOT random numbers. Personally, I find it quite difficult to parse the numbers as a date, especially as it is in an unusual format (yymmdd as opposed to the ISO yyyymmdd).

But I do see your point. I have updated the issue.

Thanks.

1 Like

I have submitted a PR!

1 Like