Originally posted by Kaz Yosh:
Please, tell me where to use what design pattern. I studied GoF design pattern and I understand what they are but I'm not quite sure how they are applied.
Thanks.
Anton Golovin ([email protected]) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
"If anything can go wrong, it will"
Anton Golovin ([email protected]) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Originally posted by Kaz Yosh:
Please, tell me where to use what design pattern. I studied GoF design pattern and I understand what they are but I'm not quite sure how they are applied.
Thanks.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
"If anything can go wrong, it will"
I want to ask you guys more specific questions but I can't cause I'm really confused with all the aspects that I have to implement. So I'll try to explain what I've done so far and what I'm trying to do next.
In my Data class, which implements DB interface, I use RandomAccessFile to retrieve data from a flat file provided by Sun.
I made RandomAccessFile static and made Data class constructor private so that I can make sure there should be only one RandomAccessFile.
I use createInstance() public method to create this object if and only if there's no instance available, otherwise, just return the reference.
As Anton mentioned, I noticed that this isn't enough to protect RandomAccessFile under muti threaded environment. Next thing I want to do is to store the data retrieved from a file to somewhere so I can reuse it later. I'm thinking about making an inner class called Contractor, by the way, I'm doing Bogditt and Scaper, within Data class and use Vector or ArrayList to store contractor objects. My first question is that if I should put this contractor class outside the Data class.
I know in the later time, I'll have to make data class serializable in order to transfer it over the network.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Originally posted by Matt Sheehan.:
You can find the GoF book here
.
Matt
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Data class provided access to your data. All you really want is the data to be sent over the network - not the entire file access class. So Data class would not normally be made serializable, nor would it be sent over the network.
"If anything can go wrong, it will"
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Originally posted by Kaz Yosh:
In my Data class, which implements DB interface, I use RandomAccessFile to retrieve data from a flat file provided by Sun. I made RandomAccessFile static and made Data class constructor private so that I can make sure there should be only one RandomAccessFile. I use createInstance() public method to create this object if and only if there's no instance available, otherwise, just return the reference.
SCJP 1.4<br />SCJD 1.4
"If anything can go wrong, it will"
I just had the craziest dream. This tiny ad was in it.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|