In this project we are going to implement a counter with various front-ends and back-ends.
The simpler version of the counter script handles a single counter. Every time we run the counter it will fetch the latest value from the "back-end", increment it by one, display the new value, and save the new value back to the "back-end". An interaction might look like this:
$ count 1 $ count 2 $ count 3
The slightly more complex version will receive a string as an input and for each string it will maintain a separate counter. So an interaction might look like this:
$ count foo foo: 1 $ count foo foo: 2 $ count bar bar: 1 $ count foo foo: 3
The front-end can be command line, or web, or maybe some other GUI.
The back-end is some kind of a "database". It can be a plain text file, some data serialization format, a relational database, a NoSQL database and who knows what else.
This is going to be a long project, but it might help understand various techniques for data serialization.
- In-memory counter using AngularJS
- Automatic counter using AngularJS
- Several counters in MongoDB client
- Command-line counter in Python for a single counter.
- A command-line counter script in Perl that uses a plain file called counter.txt for a single counter.
- Multiple command line counters with plain TSV text file back-end in Perl.
- A command line counter with database back-end using Perl DBIx::Class
- Command line counter with JSON backend in Perl.
- Counter with Perl Dancer session
- Command line counter in Perl with MongoDB as storage
- Counter with Perl Mojolicious Lite
- Command line counter with Memcached using Perl
- Increasing numbers in a text file using Perl