Question

In: Computer Science

a) Explain the relationship between "programming to interfaces" and "loose coupling," why we care about these...

a) Explain the relationship between "programming to interfaces" and "loose coupling," why we care about these two things, and why it is not possible to create completely decoupled code.

b) Given the fact that we care about these two concepts, why might this imply that the new operator is problematic for creating flexible code?

Solutions

Expert Solution

a.) Programming interfaces means that we are implementing the program using the classes based on interfaces and these interfaces determine the behaviour of the object in the classes , like we can use deifferent interfaces to define and declare various classes and then using these classes in program by inheriting these interfaces and the loosely coupling means that the various classes or interfaces are interacting with each other to deliver the desired output from the program and they are connected to each other and using data from each other to complete the tasks , we do not use the loosely coupling , our program will be very bilky and consume more resources than interpreted and make our program more laggy and more prone to bugs.

b.) New operator is problematic for the flexible code because we will needed to change the implementation of the previous classes and interfaces which will be very time consuming and confusing and as the program is coupled together to deliver the required output , we need to change or use the operator in the program in same way otherwise , the data may become inconsistent and we will lose data integrity , so prefer not to add or use new operator in the programs.


Related Solutions

What can you infer about the coupling between two objects (tight, loose, cannot say) from each...
What can you infer about the coupling between two objects (tight, loose, cannot say) from each of the following 1 They can easily be swapped with different implementations of the same class 2 Their interactions are limited and controlled 3 In order to understand one class you to open other to look at the implemenataion 4 They are very highly reliant on each other We use implementation inheritance to create a subclass that specializes a superclass either by adding some...
please briefly explain why we care about inflation
please briefly explain why we care about inflation
Power What is power and why do we care about it? What is the difference between...
Power What is power and why do we care about it? What is the difference between a type I and type II error? Which is worse? How does alpha relate to power? What are the factors that influence power? What’s the best way to increase the power of your test/study? What is effect size? One-way ANOVA There are two sources of variation. What are they? Why do we care about them? Why do we use ANOVA? In other words, why...
Describe/define/explain a. The relationship between Java's Iterable and Iterator interfaces b. An inner class c. An...
Describe/define/explain a. The relationship between Java's Iterable and Iterator interfaces b. An inner class c. An anonymous inner class d. The functionality of an Iterator remove method
Why should we care about foreign interest rates?
Why should we care about foreign interest rates?
Should we care more about APR or EAR? Why?
Should we care more about APR or EAR? Why?
Given what we know about the relationship between genes, chromosomes, and DNA, why can more than...
Given what we know about the relationship between genes, chromosomes, and DNA, why can more than one allele of a gene be present in an indívidual? Group of answer choices Because recessive alleles need to be in the presence of another recessive to show their phenotype This cannot happen; there can be many alleles for a gene, but most organisms will carry only one of them Most eukaryotic organisms have at least 2 sets of homologous chromosomes Due to blending...
What is a HIPAA breach? Why should we care about them?
What is a HIPAA breach? Why should we care about them?
Why is it important to learn about the relationship between the skeletal system and the joints.
Why is it important to learn about the relationship between the skeletal system and the joints.
When evaluating financial statements, why do we care about the industry? Why is this part of...
When evaluating financial statements, why do we care about the industry? Why is this part of the first steps of financial statement analysis?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT