None of these three is "better" -- each has an appropriate use. The third one is perfectly appropriate if you choose not to worry about versioning for the class -- i.e., if the serialized data will never be stored in a file or shared with some other revision of this same program. Otherwise the first one is perfectly fine; I can't imagine any situation where the second one would be preferable, but it's also not worse in any way.