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

basic startup questions

 
Yu Sun
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I have carefully read the SCJD5 book and the Dvd sample. However, when it comes to my real assignment (Contractor), there are some aspects that I am not very clear and want to clarify with your help. I really appreciate.

1. One method in the required interface is , should the 1 Byte Deleted Flag in the beginning of the record be included in the string[] and returned?

2. I checked some of the previous posts, it seems that in our assignment, we usually build a map between the recordNo and the String[], correct?

3. Should the index of the recordNo start from 0 or 1?

4. When we delete a record, we just need to set the deleted flag and leave the record there, rather than removing those bytes from the file, correct?

5. Since we can know the sequence, length, and the starting location of the data section, we do not need to read all those meta information in the beginning, right? In other words, we can just skip all those bytes, and start reading the records, correct?

These might be very beginner questions, but I am really a little uncertain about these after reading the SCDJ5 book and the Dvd sample project, because there are some differences.

Thank you so much.

Yu
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yu,

1/ In my opinion the "deleted" flag doesn't belong to the the String[]. If the flag indicates that a record is "deleted", this record simply does not exist. If you return the flag with the read method, you should have add that extra array element in all the String[] (update, create), just for the sake of consistency. And then it gets quiet weird: you can create a record with the deleted flag set to "true"

2/ if you want to work with a record cache, you will end up having a map with (recNo, String[]) pairs. If you just want to access your file each time, you could have a map with (recNo, recordPosition) pairs (or you can simply calculate a record's position)

3/ your choice (in java world everything is 0-based, so I prefer 0)

4/ correct

5/ I read dynamically the database schema at startup of my Data class, which makes my Data class much more reusable. Because I don't have any reference to rooms or contractors. So my Data class could also be used for a similar file containing customers for example. But Roberto (and many others) used a static database schema and after validating magic cookie just start reading the records

I am really a little uncertain

I know that feeling When I started my assignment I was also uncertain and a bit afraid of the big "automatic failure" ghost

Kind regards,
Roel
 
Yu Sun
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much, Roel. That makes sense and now I am quite clear about all of these
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic