Refactoring & SOFA Flashcards

1
Q

What is SOFA?

A

Short - method short. You can figure out what it does by looking at it.
One Thing - does one thing.
Few arguments - generally helps with one thing.
Abstraction - is abstraction consistent.

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

Why is lots of arguments bad?

A

Hard to get good testing coverage
Hard to mock/stub
If you have a boolean flag then you might know that you have a a code smell.

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

What is Quantitative ABC Complexity?

A

Square the number of assignments, branches, and conditions.
Score = square root(assigments^2 + branches^2 + conditions^2)
Gov. Standard is <= 20/module. Use Flog in Rails

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

What is Cyclomatic Complexity?

A

Edges, Nodes, Connected Components. Use a Graph.
E - N + 2P/s
Government Standard <= 10/module. Use Saikuro in Rials

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

What is ratio of code to test code?

A

You should have twice as much test code as your normal code.

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

Which SOFA guideline is most important for Unit Testing?

A

Have Few Arguments.

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

What is refactoring?

A

We want to modify code. Has the same behavior, but we transform the code to get rid of its smells.

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

What are the goals of refactoring?

A

Reduce Code Complexity
Eliminate Code Smells
Improve Testability

Eliminating bugs is NOT one of them

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

How much do plane and document spend on maintenance?

A

P&D spends ⅓ on development and ⅔ on maintenance. Customers pay 10% of software cost per year for maintenance.

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

Difference between development and maintenance?

A

Working with customer and responding to change. You can’t break the already in production code.

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

Agile vs Plan & Document in Maintenance?

A

Customer Changes request: P&D you submit a change request form. In Agile you make user stories.

Time Estimate/Cost: P&D Manager decides. Agile uses points by development team.

Triage of Change Requests: P&D Change Control Board. Agile has development team with customer participation.

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

Fix these statements about P&D:
Cost of Maintenance ___ the cost of development in P$D.
Agile equivalent to P&D change request Stories is _____.
Agile equivalent to P&D change request cost estimates is ____
Agile equivalent to P&D releases are _________.
Agile lifecycle of maintenance is similar to P&D maintenance in __________.

A
  • exceeds.
  • User Stories
  • Points
  • Iterations
  • Enhancing working software product, collaborating with customer vs. negotiating by contract, and continuously respond to change.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the main objectives of refactoring?

A

Usually results in fewer lines of code.
Should not cause existing tests to fail
Addresses explicit vs. implicit customer requirements.
Does not make usually make any changes to the test suite.

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