Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: A discussion about class existance

 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, can anybody help me?
 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Damu,
You wrote:

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
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic