Identify one or two key distinctions within that class

Assignment Help Computer Engineering
Reference no: EM132138084

When is a Subclass a Subclass

When programming, or solving any sort of problem for that matter, abstraction plays a key role in the decision-making process. It allows you to remove irrelevant details in order to understand the bigger picture.

For example, if you were constructing a program to inventory cars for sale at a used car lot, it would not make much sense to design a unique class for each separate car, especially if there are many vehicles in the lot. Instead, you would create a single "Car" class and personalize it for each vehicle.

Abstraction plays a key role in object-oriented programming. As the designer, you decide which characteristics are (and which are not) important as you define classes. In the context of the used car lot example, you could consider separate subclasses of the Car class for each make of car.

Ordering classes hierarchically can save you time and effort. For instance, a Corolla and a Camry are individual models of cars, but they both inherit certain characteristics from their shared make, Toyota.

However, hierarchies present their own challenges. Just because you can construct hierarchies, it does not necessarily mean that it is useful to do so. Consider the Unified Modeling Language (UML) class diagram below, which contains a set of subclasses for the superclass Car.

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.

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.

Reference no: EM132138084

Questions Cloud

What is the cutoff score : What is the cutoff score for the top 18% in this example?
Proportion of participants fell in category : Participants who score between 26 and 30 on this scale are categorized as overweight. What proportion of participants fell in this category?
What kind of sampling method is being used : Ten 1st grade classrooms are randomly selected from across the county. What kind of sampling method is being used?
Birdcalls during this experimental session : Assuming these data are normally distributed, what is the probability that robins made more than 11 birdcalls during this experimental session?
Identify one or two key distinctions within that class : Identify one or two key distinctions within that class that would prompt you to create subclasses instead of fields within the main class.
Students study an average : Assuming these data are normally distributed, what is the z score for students studying 45 minutes per week?
Draw a flowchart showing the steps for a cpu program : Draw a flowchart showing the steps for a CPU program that uses programmed I/O to send a string consisting of 10 characters.
Five independent components in parallel : A system consists of five independent components in parallel. The system will work if at least one of the five components works. Let Ci represent
Series of lessons taught by a substitute teacher : A researcher records the sound (in decibels) during a series of lessons taught by a substitute teacher at a local elementary school.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What are examples of databases in current

What is a federated database and why are federated databases becoming increasingly common? What are examples of databases in your current or previous work environment that could be federated.

  Compose two announcements advertising the event to be

social media can be a powerful tool to help you get the word out to a wide audience in a relatively short amount of

  How can you make improvements with a new system

What does the credit card charge form indicate about the existing system? How can you make improvements with a new system?

  Suspecting the icmp flooding attack

In reviewing your firewall logs, you notice a large number of the ICMP echo requests coming from external host 63.10.100.4. You suspect an attempted ICMP flooding attack. How could you respond.

  What is the ip address of your workstation

If you have access to the Internet at work, school, or home, what is the IP address of your workstation? Explain your reasoning.

  Figure out how opening multiple simultaneous connections

I know the processor deals with each request either by LIFO or FIFO and never gets confused about what to do and I am sure it could handle such pressures like opening multiple pages all at one time well.

  Define what is e-commerce and mobile technology

Your company is experiencing decline in business because of competition. Your manager thinks they may be able to turn the company around if they can get help.

  At what airspeed does direct cooling become impossible

An aircraft oil cooler is to be constructed using the skin of the wing as the cooling surface. The wing may be idealized as a flat plate over which air.

  Develop an overall work breakdown structure for system

Develop an overall work breakdown structure (WBS) for the 7 system development life cycle (SDLC) phases: Preliminary Analysis, System Analysis or Requirements Definition and System Design.

  You work in the computer science lab at your school and

you work in the computer science lab at your school and have been helping a student working in the lab. in your

  Investigate clinical decision support applications and

investigate clinical decision support applications and provide a summary of at least two of the applications that you

  Draw a neat block diagram showing the microcontroller

In Figure, if Vx > Vw , turn an LED ON connected at bit 3 of Port C. If Vy > Vz, turn the LED OFF. Assume that Vx > Vw and Vy > Vz will not occur at the same.

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