This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
* It must allow the user to book a selected record, updating the database file accordingly.
*Your user interface should be designed with the expectation of future functionality enhancements, and it should establish a framework that will support this with minimal disruption to the users when this occurs.
The DB interface that I am to implement has update, delete, and add methods - but according to instructions all you have to do is show the records, filter/search threw them, and book a room.
I'm confused, if you have to implement every method in the provided interface, why don't you have to provide these actions in the GUI ( like delete a record, edit a record, change what customer is booked, add a brand new record ). I already have these in my app - will I fail since the instructions said only allow them to search or book a room?
No, you won't fail. Simple because you meet the "must" requirements: search for rooms and book a selected room. So that's ok. You decided to do a lot of extra work which was not required, so you won't receive extra credit for this functionality, you even might risk losing some points (because of a bug in this extra code, the more code the more chance it has a bug). But you certainly won't fail.
So then why do they have you implement these functions in the interface, if they are never used - and how are you to test them if they are never meant to be used. off the top of my head - delete and add are usless.
Maybe searching and booking a room are the most important functionalities, so the application can be used as soon as possible. Maybe they have some batch job to insert new vacancies (and maybe this batch job will use the new program in a next version).
Never heard of testing tools like JUnit or TestNG I wrote a lot of JUnit tests to have 100% test coverage of every method in my Data class. Thanks to these testing frameworks I can develop one component at a time. So I started with the Data class, because that's the most important one of all classes. Wrote several tests and didn't need the GUI (nor the business service) to be able to know if my Data class was implemented correctly. When I made a change to the Data class I just had to run my test case (containing all tests) and I immediately knew if my (small) change broke the implementation of the given interface
Kenny Johnson wrote:So then why do they have you implement these functions in the interface, if they are never used - and how are you to test them if they are never meant to be used. off the top of my head - delete and add are usless.
Think of it from the perspective of a test designer and not only from the vantage of a stakeholder.
Implementing all the methods in the interface -- even the ones that you will not implement in the GUI -- demonstrates that you can satisfy a requirement by fully and correctly implementing an interface. Implementing one area of functionality in the GUI demonstrates that you can program from the presentation layer all the way down to the persistence layer. Implementing two areas in the GUI demonstrates that you can manage the complexity of boolean combinations correctly.
Additional areas of functionality in the GUI -- such as implementations of all the interface capabilities -- adds no marginal value in demonstrating your abilities.
As Roel notes, you can test them with a testing facility such as JUnit or even by hand. Be sure that the person grading your project will check for full functionality in the interface methods!