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

A Question about method in Data class

 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I just started my assignment but as I check instruction, they said "viewing flight information and booking a flight" .But in Data class I have method to add and delete records , so my question is should I implement all the public method in GUI or just stay with what they ask in instrucion??

I apprecite any comment,
Thanks
Sam
 
Abhinav Anand
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Data class contains many methods like add/delete but since the current requirement from the fbn assignment does not specify any need for the use of these methods.
So why to use these methods unnecesarily.
Thanks,
Any suggetions are welcome.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd just have them in your interface, and the implementation is just passing the call through to the Data class.
Even though they won't be used in your assignment, the requirement still states that the interface should have all the public methods of the Data class.
Mark
 
Jim Bedenbaugh
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:
Even though they won't be used in your assignment, the requirement still states that the interface should have all the public methods of the Data class.
Mark

I have a question. I used the MVC pattern for the GUI (I guess everyone did!), so I have the methods in the Controller portion. Is this going to meet the requirement? I mean, it's really a bad design to put all those in the View, I think. Thoughts?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim.
What you are doing basically is tightly coupling the Data class to the Front-end. Your controller now needs to know everything about the data class. There are much better, to be polite , ways of using OOP to create a clean design where there less coupling. Waht if you replace the Data class with a different kind of Data interaction. In this case you would have to rewrite your controller.
Now if you had an interface that had all the methods of the data class, and then make some implementations of it, then have a Facade class that hides the complexity, into just a few methods that the client would need. like a bookSeat method.
Do some more searching on interface designs in this forum. It should clear a lot up for you.
Good Luck
Mark
 
Jim Bedenbaugh
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:
Hi Jim.
What you are doing basically is tightly coupling the Data class to the Front-end.
Now if you had an interface that had all the methods of the data class, and then make some implementations of it, then have a Facade class that hides the complexity, into just a few methods that the client would need. like a bookSeat method.
Mark

Mark, thanks for the comments. I had to read through the thread a couple of times to get the context of your comments, because they didn't make sense to me, probably because I didn't quite tell you everything about my design.
Essentially, I have done exactly as you have stated above. Frankly, if I decouple this thing any more than it is, the classes might as well get a divorce!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frankly, if I decouple this thing any more than it is, the classes might as well get a divorce!

That is what you want them to do.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic