Skip to the content.

Zero Programming Styles

Until now we focus on code of zero system, this chapter will introduce some specifications that will be used in zero system include

Demo projects:

1. Roles

In zero system, we focus on three code areas:

Http Request flow will go through zero system as following:

Api/IrApi -> Sender ( Agent Area ) -> ( Event Bus ) -> Consumer ( Worker Area ) 
    -> Stub/Service ( Service Layer )

2. Code Structure

Here we introduce some code structures in zero real projects for developer/reader to do works.

2.1. Demo Structure

This style is not recommend in production environment because this style provide demo for you to study.

2.2. Standard Style

This style is for you to do some common Crud works only, it should not contain complex query or search operations.

2.3. Splitting Style

This style is for you to do read/write splitting in your real projects, it should contain following role and operations:

2.4. Interface Style

This style is often used and it’s fast mode, this style ignored Actor in the codes and it’s connected between Api and Worker only.

3. Name Specification

This specification is provided to developers to do standard develop works in zero system, if you obey this rules that defined in current tutorial, you’ll very luck to do this things more simpler.

If your project name is kys, we could define the root package named com.kys, then you should provide following sub-packages for different usage:

The final package structure ( include codes ) should be as following examples:

com.kys.up.god.cv
    - Addr.java
com.kys.exception
com.micro.a
    - XxxApi
    - XxxActor
    - XxxWorker
    - XxxStub
    - XxxService
com.domain
    - Xxx

The code name should be: