What is the is a and has a relation ship in oops concept in
java?
Answer Posted / crosseyed
Answer 4 and Answer 1 might both give simialr outputs but
their adoption depends on the size of a persons analytic
universe. And answer 4 is the better way to solve most
problems because it is easier to write and modify.
Much code is part of a system describing just the tiny part
of the universe an enterprise wishes to describe. If that
enterprise is a single product pizza manufacturer then for
such an enterprise the relevant universe is only pizza and
no other category of food exists to be extended in software
(profitably) by the manufacturer that is not some form of
pizza. The software engineer might wish to be a
nomenclature trailblazer, extending his code ever outward
in describing the whole universe of food. But pizza makers
are far too stingy to pay for trailblazing.
On the other hand if the enterprise is a supermarket then
the class food might (but shouldn't) be seperated from
classes for school supplies, medications and so on and
extended to include types of food. But is bagel pizza
really pizza? What about pizza crusts? Pizza crusts with
tomato sauce but no other topping? What about club soda
marketed as a cleaning supply? What about mouthwash
marketed as a cure for an alcoholics DT's? Where will we
draw the lines?
If in either case you were to use inventoryItem as a class
and add only properties sufficent to perform an inventory
you may not be trailblazing the catalogue of the worlds
foods and other stuff, but you will have much more easily
written and modified code.
World class descriptions of the universe may be a grand
ideal - but sometimes all you need do is count the number
of pepperoni pizzas! Describe only what is needed for a
purpose. Tofu, after all, can taste like fish or foul and
even Plato might not be able to categorize all its
variations depending on his ability to percieve spices!
But a store has only to tell how much of the various
packages they own sells best and how many of those are left.
Is This Answer Correct ? | 3 Yes | 10 No |
Post New Answer View All Answers
What is java command?
How destructors are defined in java?
Differentiate jar and war files?
How do I enable java in safari?
What is enhanced loop in java?
In how many ways we can create threads in java?
What do you mean by formatting?
Can you make a constructor final in Java?
Can a class be private in java?
Does set allows null in java?
State the main difference between c++ and java?
Explain the difference between extends thread vs implements runnable in java?
what is an objects lock and which objects have locks? : Java thread
What are green threads in java?
What is immutable state?