Creating separate subclasses of car

Assignment Help English
Reference no: EM131689271

In this case, creating separate subclasses of Car is more trouble that it is worth, because the inventory program probably does not have to treat different models of cars in different ways. Therefore, it is probably more appropriate simply to designate the make of the car in a field of the class, as illustrated in the UML class diagram below.

The larger question at play is this: "What characteristic of an object is significant enough to warrant a subclass rather than simply data in a field?" Think about an application in your field of expertise and the classes that you would define for that application.

Post a response that describes the application you choose and the class within that application. Identify one or two key distinctions within that class that would prompt you to create subclasses instead of fields within the main class. Explain your reasoning, giving specific examples of objects in each of the classes and subclasses you discuss, and draw a UML class diagram to support your claim.

EXAMPLE:

Basically this diagram shows that you do not need to create 4 classes (Car, Ford, Volvo, Toyota), you only need 1 class called Car with the make of the car as our extra field to distinguish the different car makes (the bottom UML calls this car make as type and declares it as a String with "type : String", I would personally call it "make : String" ;-) Anyway, same thing...

So this is an example of when NOT to create too many classes when just 1 is enough to capture all the various Car makes provided we include this "type: String" field in the class itself.

for an Organism. I cannot create a single class called Organism and slap in there the name of the organism and perhaps the size. There are just too MANY other unique characteristics that would help me characterize each of the various organisms. So I will need to create a class hierarchy. The first characteristic is whether the Organism is a Plant or Animal. These organisms are so different that I need to create 2 subclasses (children classes) under the parent Organism class.

So this leads to 1 parent and 2 subclasses so far. Then I take the Animal class for example. Again, I cannot stop here because there are so many different kinds of Animals. What types? Well, Mammals, Fish, Snakes, etc. These are soooo different in terms of characteristics that again, I am best-served to define another level in my hierarchy to be able to distinguish the various animals. Similarly there are different kinds of Plants (Trees, Flowers, etc) and you can then even go deeper and break the Trees into Fruit Trees and Shade Trees or whatever.

The bottom line is that 1 parent class is NOT enough when we need a HIERARCHY or TAXONOMY to represent the many different types of organisms. So the trick here in answering this question is to think of a hierarchy to help you define say the first 2 levels (parent and children) of this hierarchy. You do not need to go to 4 levels as I did with , , , -grandchildren), just 2 levels for L1 and L2 is enough as long as you explain why you need 2 levels as I did.

Reference no: EM131689271

Questions Cloud

Protect and handle sensitive information : An organization is predicated on trust to protect and handle sensitive information as it relates to a company or organization.
When they discovered that their iceberg is indeed melting : In the story iceberg is melting a group of penguins when they discovered that their iceberg is indeed melting and understood that they are facing
Essay on router and switch configurations : Write a 1-page (APA formatted) essay on router and switch configurations. Include specific configuration parts you deem important
Consequences of having a poor database design : If you can find anything about the consequences of having a poor database design or model please share.
Creating separate subclasses of car : In this case, creating separate subclasses of Car is more trouble that it is worth, because the inventory program probably
Discuss how a novice agile software developer involved : Discuss how a novice Agile software developer involved in collecting and documenting requirements may misapply the Agile methodology.
What is the sigma level of the entire process : A manufacturing facility uses a four-step process to assemble an automotive component. What is the sigma level of the entire process?
Accounting department employee workstations : What is the BEST solution to achieve this while retaining the ability for the server to keep the same IP address?
What type of cable should marta use to connect : She adds a new Ethernet switch and must now connect it to an existing switch. What type of cable should Marta use to connect the 2 switches?

Reviews

Write a Review

English Questions & Answers

  Write a profile

Write a profile on bishop poleni.

  Education system

Write a rearch paper on education system

  Write an report

The U.S. President Barack Obama said America can "win the future" by rebuilding its manufacturing sector (on June 8, 2011, after visiting an automotive training center at a community college in Virginia, outside Washington). Do you agree, and why?

  Discuss the accuracy of this statement

'Consideration does not have to be adequate or commercially realistic, nor does it need to be expressed in monetary terms, it merely needs to be "sufficient".' Discuss the accuracy of this statement.

  Write an essay on the youngest billionaire

Write an essay on the youngest billionaire

  Transformational leadership in the public sector

The more hierarchical an organization's authority structure, the lower the reported practice of transformational leadership behaviors.

  Modal verbs or modal constructions

Identify all the modal verbs or modal constructions in the passage

  Write a latter to mom thanking to adopting and caring

Write a latter to mom thanking for adopting and caring,

  Ways of knowing & authority in your discipline

To explore and become familiar with your discipline; to prepare you for your major researched essay.

  Writing an effective business letter

Prepare a letter in either block or modified block format, addressed to your employer or supervisor and copied to your marker.

  Discuss the kingdom of saudi arabia

Discuss the Kingdom of Saudi Arabia

  Developing an annotated bibliography

Developing an annotated bibliography

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd