Soft Dev Flashcards

(133 cards)

1
Q

Purpose of SDL

A

-Represents the development of software as phases or sets of activities
- Is driven by the desire to define a predictable process to improve quality
- Involves creating processes that can be effectively managed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Types of Software Development

A

-Waterfall
-Prototyping
-Rapid Application Development
-Agile

The selection is dependent on the project type and resources available

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the waterfall approach

A

It breaks the SDLC into distinct sequential phases. Each phase needs to be signed off before moving on. Projects are well-documented, but errors propagate through if not spotted, which is very expensive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why are iterative or incremental designe processes often used

A

-It allows you to build on an existing platform, that you have confidence in
-It reduces the amount of time and resources required to develop a new product
-It reduces the risk of failure, or issues that could delay release

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why might incremntal changes not be enough

A

-The potential capacity of the design has been reached
-The new spec is beyond the capabilities of the previous design
-The previous design is not compatible with the new assembly it needs to integrate with
-The requirements priorities have changed and the previous design is not efficiently suited

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

On a V diagram what phases match with each other

A

Requirement analysis - System in use report
Requirement specification - System test
Functional design specification - Integration test
Detailed design - Unit test
Implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain Rapid application Development

A

-Heavy focus on tool use to reduce development time and costs (IDEs, GUI builders, database management systems)
-Planning and software implementation are interleaved
-Business need paramount
-Often development deadline prioritised over requirements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is agile development

A

Development based on short iterative sprints. Examples include scrum and pair programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain scrum

A

-Based on short fixed-length sprints
-Typically 2-4 weeks long
-Aim to produce deployable software in each sprint
-Sprint planning meeting
-Daily scrum meeting
-Sprint review meeting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain pair programming

A

-Two people working on a single task - one programs and the other is responsible for direction
-Roles are reversed periodically
-Better productivity than working independently
-Promotes dissemination of project knowledge among the team
-Good for transferring skill to junior developers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Advantages of agile development

A

-User engagement
-Rapid development of usable product
-Early testing catches bugs and results in high quality product
-Small incremental changes mitigate the potential risk of introducing a large change to a system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Examples of design documents

A

-Software architecture
-Data flow diagram
-State transition diagram
-Flowchart
-Commented code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the two types of nested classes

A

-Static nested (doesnt have access to instance members)
-Inner (has access to intance members)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What modifers can a nested class be declared with

A

-Public
-Private
-Protected
-Package private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How are the nested classes accessed

A

-static nested: using the enclosing name
-inner: using an instance of the enclosing name
-all nested classes can be accessed externally through either the containing class or object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are local classes

A

Classes that are defined and exist in a block/method. They cannot contain public, protected, private or static access modifiers. They cannot access local variables unless they are declared as final. They can access all the members of the outer class instance like inner class members.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are anonymous classes

A

They are declared without any name at all. They can be defined in a method or in an argument to a method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are enums

A

They are used for creating variables with specifc ranges. They can be declared as a separate class, or as a class member, but not internally in a method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are threads

A

-Treated as a lightweight process
-Every process has at least one thread
-Threading allows for shared memory space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How does the OS handle threads on a single and multicore processor

A

-Single - virtually in parallel
-Multi - actually ran in parallel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is liveness

A

The issue of the code not performing correctly in time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How are threads created in Java

A

-Extending thread class
-Implementing runnable interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is a race condition

A

Two threads trying to access/change data at the same time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

How do you use synchronise

A

Synchronise can be used on a method or a few statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is an atomic action
It happens or it doesnt
26
What is the volatile keyword
It is used on variables to make read and writes atomic for them
27
What is Deadlock
When two threads need a resource from each other but neither can continue until they have it
28
What is Starvation
When a thread cant gain regular access to shared resources because another thread is frequently calling the object's method
29
What is Livelock
Like deadlock, except the two threads are too busy repsonding to one another to do work
30
What is wait()
Waits for a condition to occur, must call from synchronised method/block
31
What is notify()
Notifies a waiting thread a condition has occurred, must call from synchronied method/block, allows for thread communication
32
What is sleep()
Similar to wait(), does not need to occur in synchronised block, retains lock when called and sacrifices the remainder of its time slice, can only be woken by interruption
33
What is yield()
Changes running thread to runnable, allows other threads to execute, if no threads of same prority need to execute, execution continues, identifies current thread as not doing anything important
34
What is join()
Allows one thread to wait for the completion of another, responds to an interrupt
35
What is explicit locking
Locks can be created, moved and destroyed through the Lock object. They can be managed using the Lock interface.
36
Can multiple objects share a lock
Yes
37
Can an object have more than one lock
Yes
38
What is version control
Records changes over time, and specific versions can be recalled later
39
What are the 4 version control systems
-Git -Mercurial -Concurrent Versions System -Subversion
40
What are the 4 web-based repositories
-Github -Bitbucket -Google code -Subversion
41
Properties of version control
-Gives a project-wide undo button -Allows multiple devs to work on the same code base in a controlled manner, with code not being lost through overwrites -Keeps a record of changes and who did it, with reasoning -Can support multiple releases at the same time - development doesnt need to freeze before release -Can look at old versions, which is useful if customers have an issue with an old version -Has a repository to store all project files/documents/directories -Repository acts a server, usually based on a safe, secure and reliable machine
42
What are the similarities and differences between centralised and distributed repositories
Similarities: There may be multiple workstations Differences: Centralised only has one repository and others can see changes made as soon as they are committed, distributed repositories have devs pushing changes and pulling requests
43
What is the trunk
The main code base that developers are working on
44
What is a potential problem that may arise with the trunk
At the time of a new release some team devs may be fixing bugs and evaluating quality. The devs will need stability, but freezing development will waste resources
45
What is branching
It is like having two separate repositories. Each branch has its own history and tracks its changes independently. Changes can be merged back into the main trunk
46
What is forking
Historically means a schism in the dev tem or a new dev team working on a new code derived from the old
47
What is the concept of operations
-Provides a statement of goals and objectives of the system -Includes strategies, policies and constraints affecting the system - therefore contextualises the system -Clear system of responsibilities and authorites to the various participants invlove in the system -Specifies the process for initiating, developing, maintaining and retiring the system
48
What is requirement analysis
-Requirements gathering -Clear and complete requirements -Formal documentation of requirements
49
What is high level design
Will describe the platforms, systems, products, services that the developed system will depend on, will typically include an architecture diagram showing the interface, components and networks to be developed
50
What is detailed design
Specifies how the system will be constructed such as functions, objects, and method details
51
What is unit testing
-Testing individual blocks of code in terms of correctness -In procedural programming this will at function level -In OOP this is at the object/class/method level -The most widely used testing type
52
What is integration testing
Integrating all individual components to form the final system - unexpected behaviour may arise
53
What is system testing
Testing the system as a whole, ensuring it doesnt impair performance on the wider environment such as the OS or other applications.
54
What is user acceptance testing
-These plans are developed during the requirement analysis phase and are composed by users -It is performed in a user environment that resembles the production environment and user realistic data -Ensures the system meets the user's requirements and system is ready for use in real time -Validation rather than verification
55
What are the advantages of UAT
-Highly structured -Works well where all requirements are understood -Simple to understand -Easy to manage - each phase has an end review
56
What are the disdvantages of UAT
-Once a project is in testing it is hard to go back to change functionality -Not suitable for projects where requirements can change -No working software created until late in the cycle
57
What is static testing
Assessing documents
58
What is dynamic testing
Testing that invloves executing a program
59
What is white box testing
Testing where the internals of the program are known, so can test explicit paths through the system
60
What is black box testing
Treats code as a black box, and therefore only concerned with functionality
61
What is grey box testing
Know both the required functionality and also some implementation concepts which can be used in test design, but not code base exposed
62
What are the advantages and disadvantages of white box testing
-Code can be seen so tests can be designed to test many paths through the programs -However knowledge of the internals will influence the testing - can lead to bias in test design
63
What are the advantages and disadvantages of black box testing
-No knowledge of internals therefore no bias and more likely to result in tests not expected by the programmer -High probability tests will only test a small number of paths through the program
64
What is code coverage and its types
Code coverage attempts to measure how much of the code has been tested. It looks directly at the code but is not black box testing. -Function/method coverage -Statement coverage -Decision coverage -Predicate coverage
65
What is a corner case in testing
-Related to edge cases where a variable takes its max or min possible value -Many variables at their extremes is said to be a corner case -Helps to find situations where multiple extremes occur to find the more difficult bugs
66
What are the limits of testing
-It is not possible to test every aspect of a system due to number of inputs and possible paths -Testing cannot assert that the software functions correctly under all conditions, but that it function incorrectly under specific conditions
67
What are the two event listeners and how do they work
-Polling: keeps checking to see if the event has happened, easy to implement but wasteful of resources -Event-driven: has contact with the OS, waits to be notified when the event happens, complex to write but better use of resources
68
What is the delegation model
Events are only distributed objects which register to listen for them
69
What are the main components of event-driven
-Source: an object that generates an event - most often the some internal change of the source - and must register listeners for a listener to be notified -Listener: an object that notified of an event occurring - must have registered and have methods to deal with notifications -Event: an object that contains information about a state change in a source
70
How does a class become notified of events
Implementing at least one listener interface
71
What is the importance of unit testing
-Reduces time spent on debugging -Helps communicate code's intended use -Code shouldn't drift away from the limits put on them by the tests
72
How do you prepare unit tests
-Decide how to test that aspect of the code -May need to set up other instances of otehr methods if required -Write the test code either before the implementation of the tested code or concurrently, not after -Run the tests and ensure they pass
73
What is Right-BICEP
-Right: are the boundary results right -B: are the boundary conditions correct -I: can you check the inverse relationships -C: Can you cross-check the reults using some other means -E: Can you force error conditions to occur -P: Are the performance characteristics within bounds
74
What are the properties of a good test
-Automatic -Thorough -Repeatable -Independent -Professional
75
What are the guidelines for JUnit
-Each test will normally have multiple assertions -If one of the assertions fails the test will exit -When a bug is introduced only a few unit tests may fail making it easier to locate the bug -Should not add code while tests are failing -Fix any test as soon as they fail and keep tests passing as features are added
76
What is a mock object
A cheap placeholder object that is predictable and allows one to test the method needed to in the current class
77
When do you use a mock object
When the real object: -has non-deterministic behaviour -is difficult to set up -has behaviour that is hard to trigger -is slow -has a user interface -doesn't yet exist
78
How do you implement a mock object
-Use an interface to describe the object -Implement the interface production code -Implement the interface in a mock object unit testing
79
What is a test suite
Groups multiple test classes to run as a single batch and can run a specific subset of unit tests from multiple test classes
80
What is test-driven development
Code is seen from the user's POV and can help to design code better
81
What are invariants in testing
Assertions about classes/objects that should not change and should be tested when developing unit tests. Nee dto ensure an object can never be viewed in an inconsistent state
82
What are design patterns
They provide a general reusable software solution to one type of problem during development. Theory is that a problem has already been solved, exploiting the work of others. Idea is to learn code patterns, experience reuse rather than code reuse
83
What are the design pattern principles
-Identify aspects of the application that vary and separate them from what stays the same -Program an interface not an implementation -Favour object composition over class inheritance
84
What are the types of design patterns
-Creational: object creation (factory, abstract factory, singleton) -Structural: composition of classes and objects (decorator) -Behavioural: intercation between objects (command)
85
What is a factory pattern
Defines an interface for creating an object but lets subclasses decide which class to instantiate. It lets a class defer instantiation to subclasses
86
What is an abstract factory pattern
Provides an interface for creating families of related or dependent objects without specifying their concrete classes
87
What is the difference between factory and abstract factory
Factory uses inheritance and deals with creating objects of a single type giving an objetc in one shot, whereas abstract factory uses composition and returns a family of related classes
88
What is a builder pattern
Separates the construction of a complex object from its representation so that the same construction processes can create different representations
89
What are the different parts of a builder pattern
-Builder:Specifies the interface for creating parts of the object -ConcreteBuilder: Create and assembles the parts that make the object througn the builder interface -Director: Takes responsibility for the construction process of the object, but delegates actual creation and assembly to the Builder interface -Product: The object that is created, consisting of multiple parts
90
What are the benefits of the builder pattern
-Encapsulates the a complex object is constructed -Allows objects to be constructed in a multistep and varying process -Hides the internal representation of the product from the client
91
What is a singleton pattern
Ensures that a class has only one instance and provides a global point of access to it The object can be resource hungry and not always used so a cost of implementation
92
How do you create a singleton pattern
-Static member: Create a private static variable of the singleton class. This is the only instance of singleton class -Private constructor: Create a private constructor for making sure an outer class cannot instantiate object from the singleton class -Static public method: Create a global point of acess to get a singleton instance
93
What is eager initialisation
The instance of singleton class is created a the time of class loading
94
What is lazy initialisation
Ensures that the singleton instance is not created until the getInstance() method is called for the first time
95
What is a thread safe singleton
The easier way to create a thread-safe singleton class is make the global access method synchronised, so that only one thread can execute this method at a time
96
How is overhead avoided when making a thread safe singleton class
Double checked locking principle is used. The synchronised block is used inside the if consition with an additional check to ensure only one instance of the singleton class is created
97
What is the decorator pattern
Attaches additional behavioural responsibilities to an object dynamically. Code is open for extension but closed for modification
98
What is the command pattern
Encapsulates a request as an object allowing for the parameterisation of other objects with different requests, queue or log requests, and support undoable operations
99
What are the components of a command pattern
-Invoker: holds a command and asks the command to carry out the request by calling its execute() method -Command: declares an interface for all commands -ConcreteCommand: defines the binding betwen an action and receiver. Once bound, the invoker can make a request of its command object -Receiver: performs the work to carry out the request -Client: responsible for instantiating the ConcreteCommand and setting its receiver
100
What are Java generics
-Make bugs detectable at compile time therefore add stability to code -Allows algorithms to be written for types to be specified at some point later -Allows for code to be reused with different inputs
101
What are the types of generics:
-Types (usually an uppercase letter) -Methods -Generics
102
What is type erasure
-Ensures backwards compatability -Compiler removes all type information from parameters and arguments within generic classes/methods -Legacy type notation should not mix with generic types in newly produced code
103
What is heap pollution
The situation when a variable of a declared parameterised type refers to an instance that is not of that parameterised type
104
What is a collection and a map
-Collection: a group of objects known as elements -Map a group of objects where each object maps keys to values
105
What are the types of collections
-Set: contains no duplicate elements, two sets are treated equally if they contain the same elements -List: An ordered collection of elements that may conatin duplicate elements, two lists are treated equal if they contain the same elements in the same order -Queue: a collection of elements stored for processing, most concrete implementations use a first-in-first-out ordering -Deque: A double-ended queue, insertions and deletion can be done at either end, with implementation similiar to queues
106
What are the concrete sets
-HashSet: fastest but no order guarantees and has a hash table behind it -TreeSet: uses a red-black tree structure, order based on value, slower than hashset -LinkedHashSet: order based on set insertion, stored in a hash table with a linked list running through it
107
What are the concrete lists
-ArrayList: typically fastest, but not always, uses dynamically resizing array -LinkedList: doubly linked list implementation, better performing in certain cases
108
What are the concrete map implementations
Similar to set implementations
109
What is Java reflection
The ability for a class or object to examine itself and determine its structure
110
What are some features of Java Reflection
-Find out what constructors, methods, and fields a class has, limits are imposed by JVM security manager -Can change values of fields, dynamically invoke methods and construct new objects -Cannot do things it could not do with ordinary compiled Java code, such as not accessing private fields unless given permission
111
What is the similarity and differences between getFields() and getDeclaredFields()
Returns an array of field instances, however getFields() returns only public access modifiers and inherited ones, whereas getDeclaredFields() returns all variables regardless of access modifier and no inherited ones
112
What is the difference between getConstructors() and getDeclaredConstructors()
The former returns public constructors where as the latter returns all constructors
113
What does getMethods() do
Returns an array of all public methods associated with the class including inherited ones. Arguments can be passed through to return a Method relating to the specified method, which could be inherited
114
Why is class.newInstance() worse than constructor.newInstance()
Both can create classes but -The former can only invoke the no argument constructor, while the latter may invoke any constructor, irrespective of parameters -The former requires that the constructor be visible, while the latter may invoke private constructors
115
What are the uses of reflection
-Test programs by forcing specific states -Insuring a high level code coverage in a test suite -Debuggers can inspect running programs
116
What is TCP
Transmission control protocol establishes point-to-point communication between two machines. It guarantees the order of data
117
What is UDP
User datagram protocol is not connection based. Order is not guaranteed and neither is delivery. There is a lack of rror-checking and ordering overheads. It can recombine data in any order and it sends packets independent from one application to another
118
What are ports
Allows data to be spent to different applications running on the machine. All data passed over the Internet has an address and a port associated with it. In TCP, a server application has a socket bound to a specific port. In UDP, the packet contains the port number and is routed
119
What are sockets
In a server, it is bound to a particular port for a client to be able to make a connection request. The client needs a port to accept communication from the server. A new socket is set up so that teh can continue listening to request on the original socket
120
What is Remote Method Invocation
Allows an object in one virtual machine to invoke methods on another object in another virtual machine.
121
What does the server do in RMI
Makes some remote objects, generates accessible references to them
122
What does the client do in RMI
Obtains a reference and invokes a method on it
123
What is remote object location
Server application registers the remote objects with the RMI registry, pass remote object references via invocations of methods on other objects
124
What is remote object communication
It is handled by RMI framework and looks like simple method invocation from programmer's view
125
What is accessing class definitions
RMI provides the ability for passing class definitions and object contents
126
What are the components of Java RMI
-Registry: relates remote objects with names -Server: calls the registry to bind a name with a remote object -Client: looks up the remote object by its name in the server's registry and invokes a method on it
127
How do you create a distributed/remote service
-Make a remote interface (methods the client can call) -Make a remote implementation (the concrete class implementation the interface) -Use the Java compiler to generate client and server helpers automatically -Start the RMI registry -Start the remote service
128
What is dynamic code loading
-A program can download a class definition along with the object reference -Behaviours can be dynamically extended at runtime
129
What are the 3 JVM class loaders
-Bootstrap: loads core Java libraries - written for efficiency -Extensions: loads from the system wide, platform specific extension directory -System: loads from the current directory and any specified in the CLASSPATH environment variable
130
What are the 4 components of RMI architecture and what do they do
-Application layer: client and server program -Stub & Skeleton layer: intercepts method calls made by teh client/redirects thses calls to a remote RMI service -Remote reference layer: Understands how to intercept and manage refeences made from the clients to the remote service objects -Transport layer: Based on TCP/IP connections betwen machines
131
How is a remote object passed as an argument or returned as a result in any method invocation
By a reference
132
Do clients of remote objects interact with remote interfaces or their implementation classes
They only interact with the remote interfaces
133
How are non-remote arguments passed to and from RMI
By copying rather than by reference