Object-Oriented DynamoDB API

I’m a big fan of cloud computing in general and of
Amazon Web Services in particular. I honestly believe that in a
few years big providers will host all, or almost all, computing and storage
resources. When this is the case, we won’t have to worry too much anymore about
downtime, backups and system administrators.
DynamoDB is one of the steps towards this
future.

My code is not only shorter, but it also employs
encapsulation and separates
responsibilities of classes.
Table
class (actually it is an interface internally implemented by a class)
encapsulates information about the table, while
Item
encapsulates item details.

We can pass an item as an argument to another method and all DynamoDB related
implementation details will be hidden from it. For example, somewhere later in
the code:

In this script, we don’t know anything about DynamoDB or how to deal with its
RESTful API. We interact solely with an instance of
Item class.

By the way, all public entities in jcabi-dynamo are
Java interfaces. Thanks to that, you can test and mock the library completely
(but I would recommend to use
DynamoDB Local
and create integration tests).

Let’s consider a more complex example, which would take a page of code if we
were to use a bare AWS SDK. Let’s say that we want to remove all workers from
our table who work as architects: