DMS Flashcards
What is Polymorphism? Explain both methods
Polymorphism in Java means that a single interface or method can handle different types and behaviors.
Compile Time - Method overloading occurs when a class has multiple methods with the same name but different parameters.
Run Time - Method overriding, on the other hand, happens when a subclass provides a specific implementation for a method that is already defined in its superclass.
What is encapsulation?
protect some components from external access
integrating data and code into a single unit.
Just using getters and setters (like the model in MVC).
What are the advantages of using UML diagrams?
Enhances Communication and ensures the right communication.
Helps to manage complexity.
What are all the symbol in a class diagram?
+ = public
- = private
# = protected
/ = derived
$ = static
What is association relationship?
Reference based relationship between two classes
Class A holds a class level reference to class B
ex : Class Player and Class Asset. Inside class Player -> private Asset asset public player (Asset purchasedAsset)
{
}
What is dependency relationship?
Created when you receive a reference to a class as part of a
particular method
Dependency indicates that you may invoke one of the APIs of the
received class reference and any modification to that class may
break your class as well
example -> Class Die and class Player. Inside class player -> public void takeTurn (Die die)
{
die.roll();
}
Difference between dependency and association
Dependency usually invoke one of the APIs of the received class reference, whereas association doesn’t?
What is aggregation Relationship?
Very similar to association, aggregation Container and The Part just means (“has-a”) Aggregation is about creating relationships between classes where one class (the container) holds instances of another class (the part).
aggregate can be shared with others
ex : Class Player and Class Asset. Inside class Player -> private List assets
public void addAsset (Asset purchasedAsset)
{
assets.add(purchasedAsset);
}
What is composition relationship?
Relates to instance creational responsibility
Example, Class Piece and Class Player -> Inside Class Player {
private Piece piece = new Piece();
}
What is a realisation relationship?
two sets of model elements, one representing a specification (the
supplier) and the other representing an implementation (the client)
of the specification
e.g -> class SearchService implements SiteSearch
What is a generalisation relationship?
A directed relationship between a more general classifier
(superclass) and a more specific classifier (subclass)
e.g - >
class LecturerInformation extends UserInformation
class StudentInformation extends UserInformation
What are sequence diagrams used for?
A sequence diagram is used to illustrate how objects interact with each other within a system in a specific sequence over time.
What are the state machine diagrams used for?
Show the possible states of a single object, the events or
messages that cause a transition from one state to another,
and the action that result from that state change
What are activity diagrams used for?
Graphical representations of workflows of stepwise activities
What are all the design patterns and what they are used for
Factory Method, Observer, Singleton, MVC, Abstract Factory-, Adapter.
What are the five characteristics of maintainable software?
- Modularity- software organised into modular components or modules, each responsible for a specific functionality or feature
- Reusability -
- Analysability -
- Modifiability -
- Testability -
What are the 3 categories of maintainance?
- Corrective : Finding/Fixing errors
- Adaptive : adapting system to environment
- Perfective & Preventative : increase quality and prevent future bugs from occurring.
What is regression testing?
A type of software testing to confirm that a recent change has not affected existing features
What are the four ideas OOP is founded on?
- Abstraction: objects represent complex underlying code
- Encapsulation: protect some components from external access
- Inheritance: subclass extend/override functionality of superclass
- Polymorphism: provision of a single interface to entities of different types
What is to use ‘this’ keyword
when a method is used or when you access a variable inside an object, the term “this” is like a special word that refers to that specific object.
What is a collection?
an object that represents a group of objects.
What is the JCF?
Java Collections FrameWork
- contains data structures : arrays, lists, maps, etc..
- contains algorithms operations : sorting , searching, etc..
What’s the difference between aggregation and composition?
Aggregation - “is-a” relation where one class contains another as a part, but the part can exist independently.
Composition - stronger “has-a” relation where the part cannot exist without the whole.