The design philosophy of rest_rpc

The design philosophy of rest_rpc

Bellow are the design philosophy of rest_rpc:

  1. Rapid development;
  2. Easy to use;
  3. Focus on business;

Rapid development

You can develop a tcp network application in 5 minutes using rest_rpc. There is an example of a rpc server which provides some rpc service.
Firstly, define a business method ‘add’.

Secondly, register the business method as a rpc api for client.

Now You have finished a rpc server less than 10 lines code, the rpc server provide only one service.You can easily
add more rpc api as bellow:

1.define business logic:

2.register business logic:

Above example shows how to apply a business class for rpc service.
How about the client?The client code just need very little code,
Bellow is a rest_rpc client example:

1.define call protocol

2.directly call with parameters

You can develop a network application rapidly and convenient with rest_rpc, very little code is needed.

Easy to use

Easy to use is rest_rpc’s main goal, we do much effort for the goal. We hope both client and server are very easy to use.THe first principle is that RPC called just like local function calls.

At client we call a universal method ‘call’ which needs remote endpoint, RPC service name and parameters, it’s very like a local function call.We hope the user
can forget this is a network program, but treat it as a local application.

The second principle is omitted network and serialization details, because we want to use the interface as simple as we can, no extra afford.So rest_rpc do the fussy for users and they can’t feel it.

We verify RPC parameters are type correct at compile-time instead of just run-time, We can find problem as soon as possible.We utilize meta data to avoid defining a protocol file which can reduce learning costs.

At server we also do much work to simplify user interface. you can register callback of any signature with same manner, no restriction at all.

Focus on business

To be continued…

《The design philosophy of rest_rpc》有1个想法

发表评论

Copy Protected by Chetan's WP-Copyprotect.