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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -