






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







The faรงade pattern does not promote loose coupling because the client is tightly coupled to the underlying sub classes
The faรงade pattern promotes loose coupling because if anything changes in the subclasses that doesn't affect the public interface of the client isn't effected. The bridge pattern does not promotes loose coupling because the abstractions are tightly coupled to the implementations by
accelerate() method defined in ElectricCar will be called.
This is a straight inheritance question. Since TeslaModelS is an object instantiated from the ElectricCar class, the method assoicated with ElectricCar is called.
process of taking a complex process and breaking it down into its smaller, simpler parts.
relying upon another to provide a specified set of functionalities
which the elements of a module belong together. - weak strong
interdependence between software modules
An object is a set of responsibilities.
type of subroutine called to create an object. In java if you do not create one a default one is created for you. You call the constructor by using the keyword new , followed by the name of the class, followed by any necessary parameters An is-a relationship is one between a class that aggregates
Is-a relationships are relationships between classes that inherit from one another. A derived class is a form of a base class. A has a relationship is between to object where one is
True This is a true statement. Has-a relationships are when one object contains another. A computing system controls many devices the CPU, hard drive, and RAM. Each have many settings. ie. CPU ( set speed, set # of cores, power on power off), Hard Drive (read sector, read byte, write sector, write byte, power on, power off), RAM (read byte,
write byte, power on, power off). A programmer could code against the components directly to put the computer to sleep/hibernate or restore from sleep/hibernate. Instead, an interface is created encapsulating the interfaces to the components so that a programmer can now code to a new interface sleep() and hibernate(). This is an example of
The programming construct used to solve the problem is a facade because they are wrapping the interface of an existing system to an new interface. This is different than an adapter where there is an existing interface to code to. A computing system controls many devices the CPU, hard drive, and RAM. Each have many settings. ie. CPU ( set speed, set # of cores, power on power off), Hard Drive (read sector, read byte, write sector, write byte, power on, power off), RAM (read byte, write byte, power on, power off). A programmer does not like the interface provided by the sub system and wants to integrate the functionality provided into an existing interface so that they may access the functionality polymorphically. The
The programming construct used to solve the problem is an adapter because they are wrapping the interface of an existing
contain some form of aggregation. Taking a different chunk of code and wrapping it in a class using familiar functions. By using the keyword static, you not longer have to instantiate an object of the class in order to access it's methods. An example of this is the math library, where you would access the methods without actually instantiating a math object. An abstract class can have abstract and non-abstract methods. -
If a class is abstract it means it can't be instantiated, but one of the great aspects of an abstract class over an interface is that it allows the programmer to create methods that are common to all derived classes. An interface can have abstract and non-abstract methods. -
An interface defines what the methods must be implemented by a class implementing the interface. It defines the protocol for calling the method, but it does not actually have methods.
Answer > False Java does not support multiple inheritance in classes.
Answer > True Technically, you could argue java doesn't support multiple inheritance, but interfaces do a close job of approximating it. You are not really wrong if you answered this question as F. An abstract class can have final, non-final, static and non-static
This is just a good definition to know. I didn't specifically cover this in class, but added it here to let you know it if you haven't studied it closely. An interface can have final, non-final, static and non-static
An abstract class can provide the implementation of an
Abstract classes can implement methods. As long as all the methods with the right prototypes are declared, then the abstract class can implement the interface. An interface can provide the implementation of an abstract
Static variables are stored only once for all instances of the
Answer > False A class constant is created using the keyword final. It can't be changed. A static variable is instantiated once for the entire class, but it can be changed. A static data method can access static variable as well as be
Interfaces do not provide an implementation of any classes, they define what methods classes that implement them must implement.
requirements gathering. also due to communication problems. We must design to accommodate change. A class Car and its subclass ElectricCar both have a method accelerate() which was written by the programmer as part of the class definition. If TeslaModelS refers to an object of type ElectricCar, what will the following code do?