go - Should you use protobuf as the datatype you use for processing or only for transmission? -


i have matrix struct written in go. matrix struct has bunch of methods. want able efficiently compute matrix operations want able send on wire in order distribute computation.

i have matrix , methods separate protobuf definition. when need send on wire have create new pb.matrix{} existing matrix{} struct , make grpc call. seems waste. so, waste? , should defining matrix struct protobuf definition , use embedding define operations on it? or better keep them separate each other?

in terms of architecture, i'd keep them separate. agree single responsibility principle. in 1 of projects use form:

type foo struct { ... }  func newfoofromproto(f *myproto.foo) *foo { ... }  func (f *foo) toproto() *myproto.foo { ... } 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -