Skip to content

Latest commit

 

History

History
79 lines (52 loc) · 3.17 KB

File metadata and controls

79 lines (52 loc) · 3.17 KB

Software craftsmanship & Affordance

Firstly, objective of this sandbox is to practice behaviour driven development, domain driven design, test driven development.

Then, we can see today the trend to split front and back-end. These implementations often create a duplication of business rules.
Indeed, in front we see conditions on the entities to allow such or such action. What about find a way to maximize business rules in the domain (back-end) ?
REST permits exposing resources, linked actions and everything we want (if it makes sense with this resource). And more precisely when we implement HATEOAS constraint (Hypermedia As The Engine of Application State).
Thanks to that, we could reduce back and front office coupling.
We therefore speak of affordance, and I will try to implement it.

Few words about affordance and choices.

Steps

  • Describe business rules with gherkins
  • Initialize project and install needed tools
  • Implement business rules (domain, behaviour driven development)
  • Install Hateoas tool & configure it
  • First steps with affordance, expose a resource
  • Implement Domain driven design
  • Implement Event sourcing
  • Write tests which describe consumer attendees
  • Add more complex business rules
  • Add an in memory database
  • Add a database
  • Develop a front-end to demonstrate the principle

First steps

We will start this BDD training with a basic todo list application.

First of all, I write the hearth of my application, uses cases, business rules. This part (domain) has to be well tested, it carries the intelligence of my application.

I like the approach provide by jgiven. I use this library to declare my gerkhins & generate reports (json & html). After writing it, I develop my functionalities, TDD approach.

Features

Associated gherkins

Installation

Nix

Nix installation documentation.

Without Nix

Prerequisites : Maven & Jdk19

Project

mvn install
mvn test

Generate HTML reports

mvn verify

HTML reports are then generated into the target/jgiven-reports/html directory. Note that the plugin relies on the existence of the JSON output, so if the property jgiven.reports.enabled was set to false, no output will be generated.

All scenarios

Project Initialization

After some problems with a homemade version, I was inspired by Spring hateoas examples and more precisely affordances part which show how to create templates.

Templates allow to return the way you can create, modify or delete the given resource.
More information about it in Affordance documentation;

Ideas

  • Create a limit, max 10 tasks in my todolist
  • Authenticate a user and affect him some todolist