简体   繁体   中英

Difference between binding and mapping

Is there a semantically difference in the terms

  • binding
  • mapping

in means of binding an object model to another representation, for instance XML. Does one include only the one-way mapping or are both terms synonyms?

Use case

I have a Java object model and want to create a XML representation of it. For this I use reflection. Since I am not interested to generate Java code from the XML this is only a one-way procedure.

As far as I understand these terms binding and mapping are not exactly equivalent.

  • mapping is about transformation of a data structure into another (for instance: mapping a DTD to some object model).
  • binding is about giving access to some actual data through some kind of data structure (for instance binding some XML file to DOM).

This implies binding is one way, while mapping usually works both ways.

For the proposed use case I would use mapping , as creating the XML file should work for any data.

When speaking of binding an object model to some representation, it implies the target representation is some kind of data (a class in some programming language is an instance of the model, chosen between many possible ones). That is, you won't perform a binding of the XML structure to an (abstract) object model, but you will map it to some other implementation.

Not sure I'm clear enough, but I use binding between class and instance (I bind an instance to some existing class) and I map two data structures, or one data-set to another (two objects of the same abstraction level).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM