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

Is this against extensibility of application?

 
Claudio Luz
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My client has an class called DataConnector which is responsible for connection and setup of config parameters.
When the application is launched I askes config parameters to the user..
In the case of a connection in local mode the user should give the name and location of database. Well, imagine that the user says that
the datafile name is "trash.txt" . No problem, my application handles this case prompting an dialog box which display a "polite" message to user reporting that irregular case.
Ok.. Here is a sample of code that handles
file structure that is corrupted..

I have been with afraid if this code will be against extensibility future of my application...
Note, that i am using the variable HEADER_LENGTH
which precalculated to size of header of datafile
aka, db.db. I am wondering if the assessor of Sun
could use other database that had an structure different of db.db, for example an another copy
of database different.
In summary, i "always" consider that the structure
of file ( the size of header and record size are "invariant" ).
Could I lost points if i use that approach?

Claudio Luz
 
aadhi agathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Claudio Luz:
My client has an class called DataConnector which is responsible for connection and setup of config parameters.

watch out for the name, it is too specific to Data. DataRepositoryConnector/DataRepositoryFactory would be much better.

No problem, my application handles this case prompting an dialog box which display a "polite" message to user reporting that irregular case.

what is wrong in providing a .txt file . the content matters . if data contents cant be read or the db check fails the Data class itself will be hanlding it in the constructor.

public class DBFileCheck

Introducing one more class for this purpose is a over kill. But any validity check can be done by calling the static method(your impl) in the Data class constructor.but if your check is going to throw a different exception which is not already there in Data class, like FileCurrentlyOpen etc. will not be a good idea.
Any exception you can throw as a DatabaseException flavour (like Sco-Unix is a flavour of Unix ), is always allowed, as the Data class already throws the DatabaseException.
BTW, i forget to answer your topic question,
very much
Hope this helps!
[ April 03, 2003: Message edited by: aadhi agathi ]
 
Claudio Luz
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Well, maybe i change the name of DataConnector class to DataClientConnector or FBNConnector, I dont know..
My application main is called FBNMain, also have
FBNView, FBNController and FBNModel.. and others helper classes to project my gui.
2. I have one class file, namely , DataAccessFactory which besides get instantiates of local or remote clients, also, check for the integrity of database calling my class DBFileCheck .
I think that the requirement of assignment is not requesting to check the integrity of file db.db file. Therefore, if i uses DBFileCheck.java which is implementing hard code and creating this way a rigid dependecy on structure of db.db file i could *lost* some precious points in my assignment..
Maybe, i should simplify my project and therefore not implementing the integrity check using that DBFileCheck.java
Comments, please ..
Regards,
Claudio Luz
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic