OneLineIncrease efficiency by removing unnecessary characters, like whitespace.
This project was born out of two irritating sayings that I heard within one week:
- "Write a game with just one line of code!" I see this everywhere on ads to make people interested in programming. I infer that they mean that the whole game is written for you, and all you do is write "start the game" in the main method, but I wanted to make it possible to actually write a game in one line of code - just to spite these ads.
- "You need to remove all of your indents. Make it all one line. It's more efficient for the compiler." This particularly hair-pulling... insight was given to me by a fellow AP Computer Science student who does not want to be in the class at all. He thought this was funny to say, and I froze for 15 seconds while trying to figure out how to explain the stupidity of that statement in understandable terms (because "as dumb as Alpha Centauri is far away" doesn't mean much to the average person). To prove my point, I created a program to convert all of my code to one line, just to show how infuriating it is to read something without indentation.
The easy part of the program is done. It simply reads source files line by line, copies them without the line breaks, and outputs them to the given directory. The result is the same directory structure, but with each source file condensed to one line.
The next step is harder: go to one line, in one file. This will involve parsing the code, and performing a refactor similar to Eclipse's that will make all of the classes subclasses of one main class. The first step is a suitable Java parser with the ability to do such a refactor, which I have yet to find.
Additionally, there may be an option in a later version that removes all comments entirely, to "increase efficiency." facedesks