This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm using serialized ValueObject classes as return values from some stateless session EJBs. In other words, I'm sending classes that are basically just data containers across the network, and to go from JVM to JVM, they have to be serialized. Obviously, I want to keep these classes as small as possible, so that not too much data is being transmitted, thus potentially hampering performance.
So my question is whether anyone know if adding methods to these classes actually increases their serialized sizes. Assume that the methods I am considering adding do not necessitate any more members variables. An example might be that one of my classes has a few different variables that might represent its "name". If I add a complex getDisplayName() method that uses a bunch of logic to figure out for a given context what its "name" is, will I have increased the size of that class' serialized form?
Thanks in advance!
Dave Taubler<br />Specializing in <a href="http://taubler.com/articles/" target="_blank" rel="nofollow">Java and Web Development</a>
It helps to understand this stuff if you get picky about nomenclature. You do NOT "write a serialized class to disk" you serialize an instance of a class. The size of this file will depend on the serialized instance variables and has nothing to do with the methods.
All of the class methods live in the .class file as created by the compiler.