Idea: Ruby score

While programming with my friend Jocke he was really eager to show CoffeeScript. You don’t have to use parenthesis, curly braces or even semi-colons! Fantastic! Now there’ll be less bugs! </sarcasm> What was extra funny was that parenthesis are needed sometimes, but if you rewrite a bit you can get rid of them.

Example:

@milliSeconds = @getSeconds(timeReport) * 1000
#rewritten as:
@milliSeconds = 1000 * @getSeconds timeReport

As a fun game your code in CoffeScript, Python, Ruby or other could be scored on how many parenthesis you have, while nested parenthesis gives linearly more points, and the goal is to have as a low score as possible. It would be a simple practice in static code analysis, especially if the program can give tips on lowering your score – like the inverse of Page Speed.

It could traverse GitHub or something to create a Highscore leaderboard, just for kicks. What more would be fun to measure unnecessary “improvements” in your favourite language?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s