Comments (5)
I don't understand what you mean by 'external serialization'
- The reason for implementing IXmlSerializable is due to the types beeing immutable, AFAIK it is the only way to make immutable types compatible with XmlSerializer
- The reason for SerializeAsElements is that we have legacy xml with points serialized element and attribute style. This is perhaps not nice in a general library.
- Do you mean the Parse() when you say custom text format? The reason for parse is mainly that [TestCase] will read nicely in the testrunner.
from mathnet-spatial.
With internal serialization a type is responsible for its serialization (ISerializable, IXmlSerializable; .Net 1), with external serialization you typically have some static class or object that converts between different representations (e.g. ProtoBuf, Json, System.Runtime.Serialization, .Net 4). External serializers sometimes use data contract attributes to delegate the control back to the type.
The problem with serialization is that this is usually very application specific. You mentioned you have some legacy requirements regarding attributes vs elements, other users may have different requirements. Then we have parse logic that works well with the tests. In short, serialization cannot really be a responsibility of the type but of the application and use case.
In Math.NET Numerics we use external serialization exclusively, e.g. to convert between matrices and CSV, MatrixMarket or MATLAB binary streams/files.
A disadvantage of a pure external approach is that it does not integrate well with internal serializers but requires some manual work, e.g. when including points in a complex object tree that is required to be XML-serializable. I take it this is one of your scenarios?
In your particular application, do I understand it correctly that you require the same type to be serialized in either element or attribute style on case by case basis? Is this consistent within a serialized tree, or are there mixed cases where both happens within the same tree that is to be serialized?
from mathnet-spatial.
- We can remove the SerializeAsElements flag and I'll handle it in our stuff, the flag is ugly. Serialize everything as elements then right?
- The parse methods can be removed from the types but I think I like them as is just relaying the call to Parser. I have no strong opinion on this.
- Stuff like exporting to CSV or Mathlab makes sense to have as external. I think implementing IXmlSerializable has elements of nice.
from mathnet-spatial.
Great! Personally I prefer attribute style as it is more compact and closer to SVG but I'll let you decide.
Ok, let's keep the types IXmlSerializable and the static Parse methods.
from mathnet-spatial.
I removed the flags, probably forgot some. I kept ReadXml handling both element and attribute style.
from mathnet-spatial.
Related Issues (20)
- No 1D line segment support HOT 3
- Plane created from three points returns different result for Equals depending on the order of the points HOT 5
- Readme's Docs link broken
- LineSegment3D.TryShortestLineTo throws when segments intersect HOT 1
- Circle2D.FromPoints gives incorrect results for special cases.
- LineSegment2D - TryIntersect - should this return the intersection of lines or line segments? HOT 3
- Rotation(yaw, pitch, roll) uses extrinsic rotations
- Support for Matrix4D HOT 1
- Suggestion: Plane.TryFromPoints() HOT 3
- Checking for equal input points in Plane.FromPoints() is redundant? HOT 2
- I would like to contribute to the project HOT 5
- Website copyright date is not current
- Vector2D.SignedAngleTo returns bad angle result (fix described)
- Cross product error checks are different depending on whether you pass it a UnitVector3D or a Vector3D HOT 3
- CoordinateSystem: System.TypeInitializationException HOT 1
- Question: still active?
- The API on the official website is down
- Version 0.7.0 not available on Nuget HOT 7
- Why let the X, Y, Z readonly? HOT 2
- MathNet.Spatial.Euclidean.Line3D retruns UnExpected NULL HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathnet-spatial.