What is the best practice for naming my classes and packages in the given situation?

I have a project for my object-oriented software development class where I am required to create a PassengerShip for a space fight simulator.

I was planning on having the PassengerShip use the PassengerShip interface along with the PassengerShipImpl and PassengerShipFactory, in case in the future I need to make more than one type of PassengerShip.

I was going to put the PassengerShip in the package "domain", and the PassengerShip interface and PassengerShipImpl in the "passengership" package", and lastly have the "PassengerShipFactory" in the package named "common".

 Is this the best way of naming the packages? I got the idea for the common, passengership, and domain based on some same code my instructor posted pertaining to something else, but it was something he quickly whipped together for a different topic.

And now for my PassengerShip, I want to have the ability to vary the implementation of the PassengerShip later so I decided to create an impl and factory class but the problem is I don't know what to name my interface. Right now they have the same name which doesn't work and based on the project guidelines I have to call the domain class PassengerShip, so what do I call the interface?
Who is Participating?
for_yanConnect With a Mentor Commented:
Call your interface

And why do you need to have them in separate packages ?
for_yanConnect With a Mentor Commented:

 >PassengerShip use the PassengerShip interface

Do yyou mean you have a class and interface of the same name?

Don't think it is the best idea.
for_yanConnect With a Mentor Commented:
Maybe you can have abstract class PassengerShip and its implementatin non-abstract class PassengerShipImpl - that makes sense
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

EindoofusAuthor Commented:
I thought that it might be good practice to do so since I saw that my instructors code was doing that.
for_yanConnect With a Mentor Commented:
Read this discussion - I think it is related to your thoughts:


But I don't think there is one and only one way - all depends on many circumstances of how it will all be used
Hugh McCurdyConnect With a Mentor Commented:
I agree that you should mimic your professor's style.  I agree with for_yan that giving the interface and the class the same name is just asking for trouble.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.