Simplicity is the ultimate sophistication Leonardo da Vinci, 1452



...



Rapid prototyping and development

API | Services | Integration


The essence of an API | function

The first step in prototyping an API is to decouple the API's form from the function and design the conceptual API. Let's take the classic example of a cart service...


$msg cart.addItem (customerId, sku, quantity) : (cart)

$msg cart.get (customerId) : (cart)


Having an API can be easy - here's one just above (one that you can edit and fiddle with). We just defined the "cart" service, with two functions/messages... we can add details like types later.


API | form

The "form" of the API is where you map the conceptual to the physical. Although you'd do this towards the end of the prototyping stage, here's a simple REST mapping of this API - if you need to present it to any upstream services:


{{template cart.addItem:request}}
POST /diesel/wreact/wiki.Admin:Home-1/react/customer/$customerId/cart/addItem?extra=$extra&resultMode=json
Content-Type : application/json

{ "sku" : "$sku", "quantity" : "$quantity" }
{{/template}}



Mocking APIs and services

Since we now have the API specified and bound to an HTTP request, how about mocking, so we can continue developing upstream systems?

$mock cart.addItem (customerId ?= "Joe", sku ?="123", quantity ?= 5) 
=> cart.get
=> (cart=cart+{items:{sku : "${sku}", quantity : "${quantity}"} })

$mock cart.get (customerId ?= "Joe") => (cart = {customerId : "Joe", items : []})


In fact, this is also the simplest microservice you could have ever created (read more++)


Interested in accelerating microservices development ? ...

Integration and mediation

Integrating systems and composing their functionality...

$msg catalog.getPrice (sku)

$msg cart.addItem (customerId ?= "Joe", sku, quantity)

$msg billing.charge (customerId >= "Joe", amount)


APIs are often much less interesting than the stories they tell... or the stories you can create with them, i.e. systems, apps etc. The behaviour of these systems as a whole... that's where the value of the system is.



Testing microservices


$send say.hi (name = "Jane")
$expect (greeting contains "Jane")


How do we specify our expectations about the value? How do we communicate it, record it, share it, cooperate on it?



Use cases and user stories can turn into automated tests! (one that you can run and trace right now) (read more++)



Interested in simplifying microservices testing? ...


In the modern age, enterprises are transformed by microservices, APIs and reactive principles.

If you want to take a refreshing look at microservices requirements, acceptance and truly continuous testing, while fiddling with the architecture itself, start by creating a free account.





Used by companies like...

     

     


Was this useful?    

By: Razie | 2019-08-25 .. 2020-11-28 | Tags: admin


Viewed 86462 times ( | History | Print ) this page.



© Copyright DieselApps, 2012-2024, all rights reserved.