c# - Is there a correct pattern when designing network layer to easily allow upgrades/backwards compatibility? -
im currenty writing network layer of iphone app , accompanying server. iphone app operates in both host mode , guest mode, , communicates server, relaying messages on 3g between devices. both written in c#, , im using sockets. id stick binary comms, speed , efficency reasons.
is there correct design approach designing network layer, packets transferred between server , client?
should create base class first version, allows basic operation of system, inherit future versions , changes, serializing this?
i understand xml option, did tests , xml serialization on iphone orders of magnitude slower binary serialization, , ultimately, parts of network layer need binary, im sending files between devices.
my app need backward , forward compatible different versions. dont expect have large changes in future functionality, form of new features.
ive read question: backwards compatibility in .net binaryformatter
the last answer seems best option, using "manual" deserialization , serialization approach. im wondering option.
sorry question vague. need reading , come clearer questions.
it sound intending use c#, won't work on ios device. going have write seperate code device , server. given that, structure of network packets (xml or binary) not going matter because handled differently on 2 systems.
working in xml or json recommended poeple think, because have wide support , easier work custom binary format. whether slower binary form depend alot on data. , age old question ask first - difference noticable enough warrant effort. in cases, not. people tend over-emphasis necessity speed sometimes, not realising unless have lot of data transmit, network connection, not packet format, limiting factor.
so way i'd appraoch each end of equation (server c#, , iphone objectice c) create seperate class managing communications , 1 or more classes handling serialising/deserialising. gives flexibility swap out technologies , if need to.
Comments
Post a Comment