30-seconds-of-code: Categorization

Created on 15 Dec 2017  路  22Comments  路  Source: 30-seconds/30-seconds-of-code

@Chalarangelo suggested opening an issue for the wrong categorization so here it is! Let's discuss what functions need to switch categories.

discussion enhancement good first issue help wanted on hold opinions needed

Most helpful comment

Categorization needs to have rules. For example, today I tagged a snippet that converts an array into a list of <li> elements and appends them to a list. That could be both an array snippet and a browser snippet. But, seeing as browser is more specific, I tagged as a browser snippet. I think we should check existing snippets and retag based on some ruleset and specificity, then update the guidelines to make sure there's a consistent set of rules for tagging.

All 22 comments

I am not very objective, as I did the categorization myself yesterday. Suggest away guys!

  1. JSON to date should be added to Date category since it's working with dates and returning a date in the format of a string.
  2. Random integer in range and Random number in range could go to Math category since they're both using Math built-in object and they also return a number.

I think there should also be a hybrid category like array and object where both are used. Same way for strings and arrays. Also there is utility category, but there are more snippets that also fall into that category and maybe whole repo is kind of utility. So can we break remove utility category and its category should be transferred into other respective category?

I think we should keep utility, but better categorize most of its snippets elsewhere. Utility should be anything that cannot be categorized anywhere else in my opinion.

@fejes713 Your suggestions make a lot more sense than what I have done with these snippets, I'm moving them right away.

Maybe, create tags (instead of non-intersecting categories) so a function could be found by different keywords?

@Chalarangelo This sounds like a good idea, what do you think about it? Could be useful in future?

I think we should keep the categories and add tags. They could definitely bring a lot to project since we're having more and more snippets every day.

I like the idea of categories and tags working at the same time. It's a very neat way to organize everything. I'll see if I can modify the tagger script or someone else could do it.

... Wait categories weren't tags? Guess I misunderstood it earlier then. Lesson to be learned:

Don't glance, read

@skatcat31 Well, what we have right now is a reasonably simplistic categorization system I set up in like an hour, but in theory it should allow for multiple tags with a little bit of modification.

@Chalarangelo Yes though categorisation is there, but multiple tags idea is better to suggest particular snippets also belong to that respective area !!

The question is then what are the rules for tagging? What it takes? What it gives? Does that mean

const spread = (f, a) => f(...a)

is under function, utility, or array?

Mostly, at least I think so, we categorized them by our inner feeling on where they should go. For me, that whole input/output thing is nonsense. For example we have: isDivisible which takes an number but returns boolean. Category of this function is Math, on the other hand, in the same category we have arraySum which takes array but returns number ...

I would put that function in both 馃槅 (idea of multiple tags is amazing)

Categorization needs to have rules. For example, today I tagged a snippet that converts an array into a list of <li> elements and appends them to a list. That could be both an array snippet and a browser snippet. But, seeing as browser is more specific, I tagged as a browser snippet. I think we should check existing snippets and retag based on some ruleset and specificity, then update the guidelines to make sure there's a consistent set of rules for tagging.

Was that snippet ever marked as mutating?

The tagger has been updated to now mark all new snippets as uncategorized, so you can help out by tagging existing snippets in the database that are listed as uncategorized and sending a PR. Travis runs the tagger automatically during each build, so the database should always be up to date with the latest commit.

@skatcat31 no and it probably should be added as a note to make sure people know what they are dealing with.

@Chalarangelo I will try doing that now!

Right now multitagging is priority number 3 on our list, right after the restructure of #233 and adding tests as discussed in #78. Multitagging will most likely only work on the website, but we might be able to make it usable in the README as well.

The great multitagging update

As it currently stands, we need multitagging implemented as soon as possible. I'm assigning this to myself (feel free to pm me/comment here if you want to help or have a good idea). The outline is as follows:

functionX: string, utility, advanced
  • Keep tag_database and add multiple values for each snippet, instead of having just one.
  • Retroactive update of tags so that all snippets have proper tagging applied.
  • Update to the tagger, webber, builder scripts to handle these changes:

    • The tagger will keep multiple tags for each snippet, although categorize each snippet under its first tag (in the example above functionX would be listed under string).

    • The webber will add a special attribute to all snippet links with their added tags, so that it is easier to browse them when searching (so that functionX could be found using string or utility or advanced).

    • The builder will keep categorization as-is, with the exception of the advanced tag, which will add an icon or a little badge next to the snippet name in the README. This will help developers identify snippets that might require more time to understand.

    • The webber will also add a simple textual tag next to the name of snippets that are advanced, similar to the builder.

  • Add new secondary cetegories with more specific contexts inside top-level categories (e.g. we can have some specific subset in math for fibonacci which we have a few snippets for (not the best example, but I hope you get the idea)).

I will start working on these changes, which should not be too hard to implement and push within the next few days. If anyone disagrees or has a proposal to improve this suggestion, now would be the time.

Sounds simple enough. If you have any problems with the search implementation on the web let us know

@Chalarangelo 馃憦

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for any follow-up tasks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kingdavidmartins picture kingdavidmartins  路  5Comments

GrosSacASac picture GrosSacASac  路  3Comments

fuchao2012 picture fuchao2012  路  4Comments

Chalarangelo picture Chalarangelo  路  5Comments

ecwyne picture ecwyne  路  4Comments