Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A web application that randomly generates object-oriented class names
Ruby HTML CSS
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
design_docs
public
test
views
.gitignore
.ruby-version
.travis.yml
Gemfile
Gemfile.lock
LICENSE
Procfile
README.markdown
Rakefile
config.ru
spring_generator.rb
web_classnamer.rb

README.markdown

Web Classnamer

This web application randomly generates tongue-in-cheek class names suitable for object-oriented programming languages.

What it does

Make a request to the server, and it will respond with a randomly-generated class name.

The server can respond with HTML or plain text. Request the path "/index.html" (or just "/") for HTML and "/index.txt" for plain text.

The body of the plain-text response is encoded with UTF-8 and has no boilerplate: simply the class name followed by a line feed character. This allows programs to get class names without having to extract the name from HTML markup.

There are two class name generators: a generic one (example output: PrioritizedUploadWrapper) and one reminiscent of the Spring Framework (example output: RefreshableDataSourceOperationFactoryProxy). The request can supply a "generator" parameter to specify which one to use: "generic" for the generic one and "spring" for the Spring-like one. If the parameter is not supplied, the server will use the generic generator.

Examples:

  • Request "/" and the server will use the generic class name generator and respond with HTML.
  • Request "/index.html?generator=generic" and the server will do the same.
  • Request "/index.txt?generator=spring" and the server will use the Spring-like class name generator and respond with plain text.

What it's built on

This is a Ruby application. It uses the Sinatra web application framework. It uses the Classnamer gem to generate the class names.

How to run the code

To run the application, you must have Ruby installed on your system. I develop and test with version 2.2.2 of Matz's Ruby Interpreter, the reference implementation.

You must also have some version of the Bundler gem installed. You can probably install it by running "gem install bundler" at the command line.

Once you have these things installed, start a shell, go into the directory containing the source code for this application, and run "bundle install" to install the dependencies.

To run the automated test suite, run "bundle exec rake test".

To run the web application on port 9292, run "bundle exec rackup". Then you can visit http://localhost:9292/ in a web browser and hopefully see the application running.

Homepage

http://www.aaronbeckerman.com/software/classnamer/

Author

This was written by Aaron Beckerman, who you can email at aaron@aaronbeckerman.com.

Acknowledgements

Thanks to Colin Shea for suggesting the plain-text option.

Thanks to Luiz Signorelli and Marta Paciorkowska for suggesting improvements to the generic name generator.

Thanks to Franz Antesberger for suggesting the Spring-style name generator.

Copyright

This code is distributed under the MIT License (also known as the Expat License). See the LICENSE file for details.

Something went wrong with that request. Please try again.