c++ - How to organize import and export code for versioned files? -


if application has able open (and possibly save) file format last n releases, how should code organized sanely updating file format easy , less error-prone? assume file format in xml, , functions take in objects export , produce objects import.

append number end of each function name, , copy/paste , increment number each new version? that's maintaining multiple versions of version-controlled functions within source code. perhaps magic @ build time?

firstly, supporting import of old versions lot easier export. because later versions different because support more features. hence saving old format may mean loss of data. consequently, experience has been on supporting import of multiple versions, spanning on decade.

xml of course smart solution. designed problem in mind. key point me clean code structure follows clean data model. provided new versions add features , these represented support additional tags, not have recode handling of existing tags @ all.

now could change semantics of existing tags, requiring recoding. solution: don't if can avoid it. when add attribute or tag, make sure define default value , old , new data files handled seamlessly.

so seems me care should able avoid many cases have different code handling same fields in different file versions. occur, guess there "special circumstances" (that's life software). when design generic solution you'll have specific use cases in mind, , such special cases may not handled anyway.

in summary: you'll future proof efficiently via defining upgrade path data model.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -