Anatomy of an Executable Architecture
A few months ago, we released the Parallel Agile Add-in for Enterprise Architect. This add-in gives Enterprise Architect users a unique opportunity to save substantial amounts of time in building the database infrastructure for your project, because you can now generate it automatically from a domain model (class diagram). What gets generated includes database access functions, an API to access the database, API documentation of, and some client side code that shows you how to call the API - what we're calling an Executable Architecture. Our first target platform is MongoDB and Node.JS (aka MEAN Stack), but we're currently working on additional platforms including MySQL and Firebase, so stay tuned.
Meanwhile, let's say you’re starting a new MEAN Stack project and you’re going to need a MongoDB database, Node API to access it, API documentation and some client-side code, so you can start prototyping. How fast can your engineering team get it done? How about an hour?
With Parallel Agile CodeBot you can spend an hour or so with the project stakeholder, BA and a bunch of other people, creating a domain model. Then simply right-click in the model and click Generate Project. Seconds later, you have a complete, working API, client library, Swagger API docs, and it’s already hosted as a live prototype API for your team to try out.
Here’s an example of what CodeBot will create based on your domain model, for a Node/Mongo architecture:
Let’s say you’re creating a single database collection called PaymentMethods. Typically you would need to create at least all of the following, just to be in a position to start prototyping the UI and so forth.
First, you would need to build the basic set of database access functions for each database collection (or table) that you’re going to need. These are the CRUD (Create, Read, Update, Delete functions). In a NoSQL database like Mongo these are implemented with GET / PUT / POST methods:
Next, you would need to define a REST API to allow your client-side code to call the database access functions. In a MEAN Stack application these are bundled together in an Express JS file as shown above. Note that each of your database access functions has several layers of exception handling that need to be built.
After creating the API, you’ll need to create API documentation so that your client-side developers know how to call it:
Or you might write a Java client:
It’ll make sense for your Java client to have an entity class (often referred to as a Plain Old Java Object or POJO) available for each domain object:
All of this code is infrastructure for your project, and tends to be of a somewhat boring and repetitive nature - you always need to write the database access functions, they need to be written for each collection, and the code is all very similar to the code you wrote yesterday. Writing it by hand is slow, tedious, and error-prone.
Yet in thousands of development organizations around the globe, developers are writing the database access layer of their applications manually. We asked ourselves if there was a better way and decided the answer was yes. And then we built it. If you’d like to try it, download the free Parallel Agile Add-In for Enterprise Architect.