The Elixir Scribe tool aims to help developers to embody the values of discipline and craftsmanship of the Scribes, enabling them to more easily write clean code in a clean software architecture for enhanced developer experience and productivity.
Mix Task to generate a folder structure organized by Domain, Resource and Actions
Why?
To enable developers to write Clean Code in a Clean Software Architecture that respects the Single Responsibility Principle.
The traditional approach in software development tends to group all actions for a resource under the same module, which violates the Single Responsibility Principle because the module has more than one reason to change, as many as the number of actions on the resource.
What?
What to expect from this task is that when the developer executes the mix scribe.gen.domain ... command in the terminal, the result is a folder structure where a module is created for each action of a resource in a domain. This respects the Single Responsibility Principle because each module only has one reason to change: the business logic for the single action it is responsible for.
When?
The developer should use this generator whenever they need to create a new feature scoped to the core business logic. For features that also require interaction with the external world, the developer needs to use one of the other generators that will invoke this one. For example: mix scribe.gen.html, mix scribe.gen.live, mix scribe.gen.api, and others.
Acceptance Criteria
Let's base the acceptance criteria's on a developer tasked with building an Online Shop.
1. Creating a Domain Resource with the Default Actions (CRUD)
Feature: Adding the Sales Catalog
Scenario: Adding the Category resource to the Sales Catalog with the default actions (Create, Read, Update, Delete)
Given that the developer is on a terminal
When it executes the command mix scribe.gen.domain Sales.Catalog Category categories name:string desc:stringThen it generates a folder structure with a module per each CRUD action (create, read, update and delete) for the Category resource of the Sales Catalog domain.
2. Creating a Domain Resource with the Default Actions (CRUD) and Extra Actions
Feature: Adding the Sales Catalog
Scenario: Adding the Product resource to the Sales Catalog with the default actions (Create, Read, Update, Delete) and Extra Actions (import, export)
Given that the developer is on a terminal
When it executes the command mix scribe.gen.domain Sales.Catalog Product products sku:string name:string desc:string --actions import,exportThen it generates a folder structure with a module per each action (create, read, update, delete, import and export) for the Product resource of the Sales Catalog domain.
3. Creating a Domain Resource only with Extra Actions
Feature: Adding the Warehouse Fulfillment
Scenario: Adding the Fulfillment Order resource to the Warehouse Fulfillment Domain only with the list action
Given that the developer is on a terminal
When it executes the command mix scribe.gen.domain Warehouse.Fulfillment FulfillmentOrder fulfillment_orders uuid:string label:string total_quantity:integer location:string products_sku:array:string --no-default-actions --actions listThen it generates a folder structure with only one module for the extra action list.
Mix Task to generate a folder structure organized by Domain, Resource and Actions
Why?
To enable developers to write Clean Code in a Clean Software Architecture that respects the Single Responsibility Principle.
The traditional approach in software development tends to group all actions for a resource under the same module, which violates the Single Responsibility Principle because the module has more than one reason to change, as many as the number of actions on the resource.
What?
What to expect from this task is that when the developer executes the
mix scribe.gen.domain ...
command in the terminal, the result is a folder structure where a module is created for each action of a resource in a domain. This respects the Single Responsibility Principle because each module only has one reason to change: the business logic for the single action it is responsible for.When?
The developer should use this generator whenever they need to create a new feature scoped to the core business logic. For features that also require interaction with the external world, the developer needs to use one of the other generators that will invoke this one. For example:
mix scribe.gen.html
,mix scribe.gen.live
,mix scribe.gen.api
, and others.Acceptance Criteria
Let's base the acceptance criteria's on a developer tasked with building an Online Shop.
1. Creating a Domain Resource with the Default Actions (CRUD)
Feature: Adding the Sales Catalog
Scenario: Adding the Category resource to the Sales Catalog with the default actions (Create, Read, Update, Delete) Given that the developer is on a terminal When it executes the command
mix scribe.gen.domain Sales.Catalog Category categories name:string desc:string
Then it generates a folder structure with a module per each CRUD action (create, read, update and delete) for the Category resource of the Sales Catalog domain.2. Creating a Domain Resource with the Default Actions (CRUD) and Extra Actions
Feature: Adding the Sales Catalog
Scenario: Adding the Product resource to the Sales Catalog with the default actions (Create, Read, Update, Delete) and Extra Actions (import, export) Given that the developer is on a terminal When it executes the command
mix scribe.gen.domain Sales.Catalog Product products sku:string name:string desc:string --actions import,export
Then it generates a folder structure with a module per each action (create, read, update, delete, import and export) for the Product resource of the Sales Catalog domain.3. Creating a Domain Resource only with Extra Actions
Feature: Adding the Warehouse Fulfillment
Scenario: Adding the Fulfillment Order resource to the Warehouse Fulfillment Domain only with the
list
action Given that the developer is on a terminal When it executes the commandmix scribe.gen.domain Warehouse.Fulfillment FulfillmentOrder fulfillment_orders uuid:string label:string total_quantity:integer location:string products_sku:array:string --no-default-actions --actions list
Then it generates a folder structure with only one module for the extra actionlist
.Folder Structure for all Acceptance Criteria's