aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: Class Contractor? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: Class Contractor?" Watch "B&S: Class Contractor?" New topic
Author

B&S: Class Contractor?

Fabio Kimura
Greenhorn

Joined: Jan 17, 2005
Posts: 6
Hello!
I'm working on B&S assignment, and I am confused: Do I have to create a Contractor class or not? I mean, do I have to create a class to represent the contractors, encapsulating atrributes like name, location, specialties, size, rate, owner, etc. as a Value Object?
If I do, then why the heck the database interface returns a String array instead of an Object or a Contractor in the read method? Also, the create record method has a String array as parameter.

I am very confused, because SUN's SL285 course project has the database interface already returning Value Objects or array of Value Objects (like a Customer class, with name, address, SSN, etc.).

Thanks in advance,

Kimura
[ January 20, 2005: Message edited by: Fabio Kimura ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
You can edit your original topic title by using the icon like a paper and pencil. And the other text of course.
[ January 20, 2005: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Daniel Simpson
Ranch Hand

Joined: Sep 02, 2004
Posts: 181
Originally posted by Fabio Kimura:
Hello!
I'm working on B&S assignment, and I am confused: Do I have to create a Contractor class or not? I mean, do I have to create a class to represent the contractors, encapsulating atrributes like name, location, specialties, size, rate, owner, etc. as a Value Object?
If I do, then why the heck the database interface returns a String array instead of an Object or a Contractor in the read method? Also, the create record method has a String array as parameter.

I am very confused, because SUN's SL285 course project has the database interface already returning Value Objects or array of Value Objects (like a Customer class, with name, address, SSN, etc.).

Thanks in advance,

Kimura

[ January 20, 2005: Message edited by: Fabio Kimura ]


I created a Contractor class but I did that because I decided to cache my records. It made reading a heck of a lot easier IMHO


SCJP 1.4<br />SCJD 1.4
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by Fabio Kimura:
Hello!
I'm working on B&S assignment, and I am confused: Do I have to create a Contractor class or not? I mean, do I have to create a class to represent the contractors, encapsulating atrributes like name, location, specialties, size, rate, owner, etc. as a Value Object?
If I do, then why the heck the database interface returns a String array instead of an Object or a Contractor in the read method? Also, the create record method has a String array as parameter.

I am very confused, because SUN's SL285 course project has the database interface already returning Value Objects or array of Value Objects (like a Customer class, with name, address, SSN, etc.).

Thanks in advance,

Kimura

[ January 20, 2005: Message edited by: Fabio Kimura ]


You can't modify the interface provided with your assignment. It returns an array of Strings, so you must use those. You can wrap that data in a Value Object (DTO) at any step along the way. I do it after the data arrives at my client. You could also just use the array of Strings and never build a DTO. It's up to you, I use the DTO because I wan't to implement the Comparable interface between data objects so I could sort them and I wanted to provide methods for determining if they were bookable.
Vincent Hernandez
Ranch Hand

Joined: Oct 17, 2004
Posts: 43
One thing you gotta keep in mind is that the interface Sun provides is supposed to abstract. That is, it won't be bound to a particular application. If they supplied an interface with Contract arguments and/or return value types, that wouldn't keep the interface as abstract.

With regard to using a Contractor class or not, I sure do. I provide also for a constructor, Contractor(String[]), which converts the string array to a contractor, and a toStringArray method, which outputs the Contractor object to a String[] object.

Why use it? Because it makes things clearer to understand if you wrap that information into a Value Object. I use the Contractor objects within my Data class code. When you read in a String[], convert it using the constructor i mentioned. When you gotta return a String[], call toStringArray.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11285
    
  59

Hi Fabio,

I am very confused, because SUN's SL285 course project has the database interface already returning Value Objects or array of Value Objects (like a Customer class, with name, address, SSN, etc.).


Courses and books cannot give away a solution to the certification assignment. The creators of the courses and books have to create subtle (and sometimes non-subtle ) differences to ensure that candidates for the real certification really do the work.

So you may find that there are several areas where the real Sun Certification assignment differs from the coursework you did. However there should be nothing in the assignment that was not covered in the course. You just have to adapt the course information to fit your assignment.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S: Class Contractor?
 
Similar Threads
B&S - Contractor
B&S 2.3.1 Booking ?
B&S: database design..please review
NX: Bodgitt and Scarper and design/synchronization questions
NX: B & S - Is this design too complex??