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.
- Command-line counter in Python for a single counter.
- Python and MongoDB
- Flask counter with SQLite, SQLAlchemy, pytest
- 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
- Counter example in Perl using YAML file to store the data
- A counter using Perl Dancer and an in-memory SQLite database
- A counter using Perl Dancer and Redis, both in a Docker container
- Simple In-memory counter using AngularJS
- Automatic counter using AngularJS
- Several counters in MongoDB client
Published on 2019-03-30