uml-modelling, inheritance of interface?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zahit
    New Member
    • Mar 2008
    • 10

    uml-modelling, inheritance of interface?

    Hi all,

    I have a scenario like that,

    Engine Driver
    • Captain : The Engine Drivers who reach “Enough Track Experience” and “Enough Year of Employee”. “Enough” terms can be changed in time. It must be flexible.
    • Assistant Captain : The Engine Drivers who can not be captain yet.
    • Certified Engine Drivers : The Engine Drivers who has a certification to operate High Speed Train. Either a Captain or an Assistant Captain is able to be a Certified Engine Drivers.

    I want to show this relations using class diagram. But I couldn't figure out how "track experience" and "year of employee" variables can be flexible. "Certified Engine Drivers" is another problem, because both captains and assistan captains can be a certified engine driver, so it sounds like a type conversion is needed? Thanks in advance..
  • Joseph Martell
    Recognized Expert New Member
    • Jan 2010
    • 198

    #2
    why would you like to use inheritance for these relationships? Unless there is something substantive changing from one type of driver to the next, inheritance will be overkill. You could use properties to represent these aspects of a driver instead of inheritance:
    Code:
    enum EngineDriverRank
    {
        Captain, AssistantCaptain
    }
    
    class EngineDriver
    {
        public void PromoteDriver()
        {
            //check promotion requirements
            //if enough experience _rank = Captain
        }
    
        private EngineDriverRank _rank;
        public EngineDriverRank Rank
        {
            get
            {
                return _rank;
            }
        }
        public bool Certified
        {
            get;
            set;
        }
    }

    Comment

    Working...