Live data from Hacker News

Show HN: Beautify-with-words unminifies JS with unique words for variable names

github.com

31–35 of 35 posts

Re: Show HN: Beautify-with-words unminifies JS with unique words for variable names

#31

While it's a good idea, I feel like it should rename with real words, or not rename at all. From the example: function(bedad, latay, vublu) { if (!adag(this, "on", bedad, [ latay, vublu ]) || !latay) return this; this._events || (this._events = {}); var cyem = this._events[bedad] || (this._events[bedad] = []); bedad, latay and vublu don't make it much easier to remember which variable is which than just using a,b,c

I forked the original to address this [1]. Here's a sample: var strategy = moduleInterfaceFactory.Events = { on: function(strategyFacade, strategyFactoryDecorator, interfaceFacade) { if (!flyweight(this, "on", strategyFacade, [ strategyFactoryDecorator, interfaceFacade ]) || !strategyFactoryDecorator) return this; this._events || (this._events = {}); var strategyPattern = this._events[strategyFacade] || (this._events…

While I find this humorous (which I assume was the goal), I think using common development terminology could be worse than complete jibberish since you start to apply irrelevant meaning when reading the beautified code.

Re: Show HN: Beautify-with-words unminifies JS with unique words for variable names

#32

I've always wondered what coding is like for those who don't speak english, or only speak a little. I imagine it's something like working with code beatified by this tool. Almost every codebase is filled with english verbs and nouns. They are one of the primary tools for making source code readable by humans, not just machines. Very cool tool.

Basic stuffs are not that difficult, i mean function/for/while/var ... is easy to understand wherever one comes from.

The biggest benefit of being an english native speaker is that most resources on the web are in English(docs,articles,videos). And since being a developper is about learning new things all the time, it's easier to learn about new technologies or tools when one can read english articles or documentations.

My english (writing and speaking) is horrible but i force myself to read english docs on a regular basis,because it's just mandatory today.

Re: Show HN: Beautify-with-words unminifies JS with unique words for variable names

#33
post #6

While it's a good idea, I feel like it should rename with real words, or not rename at all. From the example: function(bedad, latay, vublu) { if (!adag(this, "on", bedad, [ latay, vublu ]) || !latay) return this; this._events || (this._events = {}); var cyem = this._events[bedad] || (this._events[bedad] = []); bedad, latay and vublu don't make it much easier to remember which variable is which than just using a,b,c

I'm the author. Since "a", "b", "c" get recycled by different scopes, it makes it really hard to figure out which "a" you're looking that. By having unique names, you can easily spot where one variable is used exclusively. I was going to use a dictionary but I didn't want the tool to be language specific or run into unsavory words.

You could use first names as your dictionary. The US Census Bureau has lists† (in the form of frequency tables) of male and female given names.

http://www.census.gov/genealogy/www/data/1990surnames/names_...

Re: Show HN: Beautify-with-words unminifies JS with unique words for variable names

#35
post #24

Earlier quoted context omitted.

You might find ngmin[1] helpful for that. Then you can use the shorter injection syntax and have it expanded via a compilation step. Since you mentioned Grunt, you'd probably want to just use grunt-ngmin[2]. [1] https://github.com/btford/ngmin [2] https://github.com/btford/grunt-ngmin

How I never found that.. thanks! That is going to save us a world of pain in debugging.

Glad to help!
Post reply on HN