Tag Info

New answers tagged

1

One common approach is to design your application model in a way that is entirely independent of your user interface framework, and then implement an adaptor between the two. This allows your application to treat its UI as a plugin, which can be beneficial (both for testing and for later addition of features that may benefit from a different UI, e.g. ...


1

Serialization is a two part problem: Knowledge about how to instantiate a class aka structure. Knowledge about how to persist/transfer the information that is needed to instantiate a class aka mechanics. As far as possible, structure should be kept separate from the mechanics. This increases the modularity of your system. If you bury the information on ...


7

I generally avoid having the class know how to serialize itself, for a couple of reasons. First, if you want to (de)serialize to/from a different format, you now need to pollute the model with that extra logic. If the model is accessed via an interface, then you also pollute the contract. public class Image { public void toJPG(String filePath) { ... } ...



Top 50 recent answers are included