Hi, I had seen the old version SCJD exam FBN, they provide some of the classes in the assignment. In the new version assignment, there is only an instruction, the candidate decides how many and what classes should exist. Considering the database, other than Data, DataInfo, FieldInfo class, I think there should be Data, Schema class. As to DataInfo class, I think it is unnecessary. It can be stored in an array, all its field information can be extracted from Schema class. And FieldInfo can be replaced by Schema class. I think the existance of a class should be as few, simple as possible. Need your comment. Thank you! Regards, Damu [ September 08, 2003: Message edited by: damu liu ]
As to DataInfo class, I think it is unnecessary. It can be stored in an array, all its field information can be extracted from Schema class
I agree with you that the DataInfo class is unnecessary. I called my Schema classs DataSchema. You can certainly call it Schema. But you have the right idea. As a rule, I don't create classes unless I see a need to. Also, I try to design them such that a class does one thing well and not many other things at all. Regards. Bharat
Hi damu and Bharat, I totally agree with you that DataInfo class is unnecessary. And I have also a Schema class I called MetaData. But I think a FieldInfo class is handy (I called it Field). Is your Schema class stores information on a database file as whole, it's also a collection of field objects. Why not to store that repeated field information in a separate Field (or FieldInfo) class ? It's seems more natural to me. Regards, Phil.
posted 17 years ago
Hi buddy, I am very glad to see your reply. Hi, Phil. , since you agree that Schema should exist, what do you suppose the Schema class will do? The Schema should deal with the fields info, in my opinion, thus the Schema class and the Field class will have something in common. Or can I consider it is a little duplicated to have two classes? Regards, Damu
posted 17 years ago
Hi damu, Schema stores all information unique to the database file (signature (magic cookie) + a collection of Field (or FieldInfo) objects. While Field stores all information unique to a given field. In other words, there is a one-to-many relationship between Schema and FieldInfo, that's why I think that is better design to have two separate classes. But it's not mandatory of course. BTW, it's even possible to have no Schema class, letting Data manage the whole stuff... Regards, Phil.