1.3 KiB
1.3 KiB
Service Oriented Programming
- tags
- programming architecture
- source
This is a presentation of a design pattern to architecture a big code source. As most programming architecture, the goal is to optimize modularity.
First, this focus on functions. There will be no global variable. There are two kind of functions in programming, pure and impure functions.
From a high level perspective:
lib/
contain pure functionsservices/
contain all services
The services directory will contain "sub-project"/"modules". Every service should have the following structure:
-
src/
service
the service declarationcore
the implementation of the function in the service, should contain pure functionsschemas/types
the metas structures (data format mostly)routes
if you service is a web service, routes declarations
-
test/
service_test
the service testcore_test
the tests for pure functions
A service should be considered as a function returning a record of functions.
foo-service-methods
foo-do-a
foo-do-b
foo-do-c
def foo-service
create-service( config-service, bar-service, baz-service)