answers
Define waterfall development - ANSW- When we go through stages of development,
each one feeding into the other.
So we end up designing early on, and then coding and testing later on
The issue is this way does not give much scope for going back through and working
after a phase has ended
What's the main issue with not designing a software correctly - ANSW- The cost to add
something new will gradually keep increasing, until it becomes to hard to add something
new.
What are the elements of simple design (4) - ANSW- - Have fewer elements
- Maximises clarity
- Minimise duplication
- Behaves correctly
What is test driven development - ANSW- - We write the test for a feature we want to
implement
- We write code to pass that test (simplest code)
- We then refactor to make the code better (clean up, remove duplication etc)
- Then we cycle again
Whats a good thing about TDD and having tests in the refactoring stage - ANSW- We
have a safety net in case it fails
What is behaviour driven development - ANSW- - This uses TDD, but focuses on
people thinking about the behaviour rather then the implementation
- So how it works is we will write out the functionality in natural language
- We will then use this to write out a test
Give me a example of Behaviour driven development - ANSW- CustomerLoopup
- find customer by id
- fails for duplicate customers
- ...
public class CustomerLoopupTest {
, @Test
findsCustomerById(){
}
...
}
Define refactoring - ANSW- Changing the design of code without changing functionality
In TDD when should we refactor - ANSW- In a green state, as we have a test to check
for functionality
Define technical debt - ANSW- Say we have a time constraint, and we copy a block of
code and we know we should refactor but we don't, this can cause technical debt to
build up, and if we don't pay it a system can become harder to work with
What's the con of doing many small refactoring's instead of one big one - ANSW- -
Harder to explain them
- Technical debt has built up over time, so longer to achieve the refactoring's
Describe composing methods - ANSW- When we take a large method, and split it up
into chunks.
Describe Separate Responsibility - ANSW- Say we have one for loop which does 2
things in it, we may want to split this up into 2 for loops which each do separate things,
which may make the code easier to follow
Describe inline variable - ANSW- When we take something which was assigned a
variable, and just use that something without assigning it.
Describe duplication between classes - ANSW- Literally in the name. Sometimes if we
have a lot of duplication, we may want to move the common codes into their own
objects
Describe rename to tidyup - ANSW- Sometimes the names we use are long and
unnecessary, so we can now rename to make it easier to read
Describe replace conditional with polymorphism - ANSW- - So in OOP we do not like
conditionals, we don't want to make decisions based on information we just got. Instead
we want the person we got the data from to make the decision for us
- So to make sure this happens we can replace the conditionals with polymorphism
7 refactoring terms - ANSW- - Separate Responsibility
- Compose Method
- Inline Variables
- Rename Variables