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.
What is inheritance?
Forming new classes based on existing ones
SuperClass and SubClass
Differentiate between abstract classes and concrete classes
Abstract classes = provide a blueprint for other classes and may have abstract methods, can’t be instantiated has to be extended.
Concrete classes = are complete and can be instantiated directly.
Differentiate between interfaces and abstract classes
Abstract classes: can have both abstract and non-abstract methods; can have fields, constructors.
Interfaces: can only have abstract methods; can only declare method signatures
- classes can implement multiple interfaces, but can inherit from only one abstract class
What is the aim of refactoring?
Improve code quality
Enhanced readability
Maintainability
Examples Of Build tools
Maven and Gradle
Why use build tools?
Project Compilation
Dependencies
Allows for better maintenance
Automated testing
What is the POM file?
Project object model
- Contains configuration about your project, e.g. dependencies, plugins.
Why should we use FXML?
Whilst the programmers resolve the back end the designers can use external software (Scene builder) to design the UI. Building GUIs visually instead of programatically makes intuitive sense. Can test/fix application logic without touching the GUI design or vice versa.
What is the abstract factory design pattern?
Create families/factories of related objects without imposing their concrete classes
What is the Factory Method design pattern?
Provides an interface for creating objects in a superclass but allows subclasses to alter the type of objects that will be created.
What is the Singleton design pattern?
Ensures a class has only one instance and provides a global point of access to that instance.
What is the Observer design pattern?
an object, named the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.
What is the adapter design pattern?
Allows incompatible interfaces between classes to work together without modifying their source code.
MVC
The communication between each goes like this:
view -> controller , controller -> model, controller & model -> view
What does a VCS mean?
Version Control System
What is an example of a VCS?
Git
Why use VCS?
Track Changes
Recover Old Version
Works Across networks
How to deal with concurrency management
Lock-Modify-unlock solution
Copy-modify-merge solution
What is abstraction?
The process of hiding all the non-relevant data about an object in order to reduce complexity and increase efficiency.
What is an interface in java?
An interface in Java is a collection of abstract methods (methods without a body) and constants.
In JavaFX, what can you do to prevent the GUI become unresponsive?
- Heavy computation should be done elsewhere to prevent freezing
- Package “javafx.concurrent” provides a way for JavaFX to create and communicate with other threads
Who is involved in refactoring?
Programmers / Developers
Senior Designers
Management
System Architects
What is OSS? Open Source Software
OSS is (generally) free software that uses any licence approved by the Open Source Initiative
(OSI)
What is Free OSS?
Software that gives users rights to run, copy, distribute, change and improve it as they see it
without any permission and payments to any external group or person.
Why use open source?
Higher Quality
Customisable
Improvable
Collaborative developing
Free
Why are there software licenses in place?
To protect the user as well as their code.
Rules needed to secure certain freedoms e.g. ->
What can be done with the code
Who can change it
Who can distribute it
What are common OSS licenses?
Permissive: users can produce ‘closed source’ versions and sell the software
CopyLeft : users can do the same as permissive however same rights as the original OSS that modifications were made on have to be applied, e.g. providing source code and allowing modifications.
What are the SOLID principles?
S ingle responsibility principle
O pen-closed principle
L isko’s substitution principle
I nterface segregation principle
D ependency inversion principle
What is the single responsibility principle
Means that a class should have one and only responsibility.
What is the Open-Closed Principle
States that once a class is complete and working correctly it should be open to extension with things such as new components that don’t change the source code but add new behaviours to it. However it should be closed to modifications so the source code can’t be changed.
What is the Lisko’s substitution principle
objects of a superclass should be able to be replaced with objects of a subclass without affecting the correctness of the program.
What is interface segregation principle
States that no code should be forced to depend on interfaces it does not use
What is the Dependency inversion principle
he high-level modules should not depend on the low-level modules. should depend on abstraction and the abstractions should not depend on the details.
Why is it important to avoid duplicate code?
Minimise the risk of having errors in multiple places.
What does it mean to pull up or push down?
Pull up : means to move something from the base class to the superclass
Push Down: means move something from the superclass to the base class.
What is technical debt?
The hidden cost of opting for a quick simplistic solution in software development.