SCRUM is a management process – it will not improve code quality.
Writing the correct software vs. Writing the software correctly
SCRUM only helps with writing the correct software – it ensures the requirements are current, and
the project owner is kept in the loop. It also helps the project manager to plan, which means
they can create nice diagrams. And project managers love diagrams.
How does SCRUM help with the second thing?
To write software correctly, (that is to write software which is of a high quality and is easily maintainable), a methodology needs to recommend at least:
1. Write tests (for bonus marks, write automated tests)
2. Peer review code
Having tests improves quality because…
1. It’s pretty obvious isn’t it? Do i need to write a list?… okay:
2. Unit tests (for example, tests written using NUNit) prevent new code breaking existing code
3. Unit tests make refactoring safer, which should encourage refactoring, and refactoring creates a cleaner design over time, which helps with many things i won’t go in to here
4. Unit tests, when written to highlight a bug, can prevent regressions of the same bug
5. Functional tests (when automated – tests written in Selenium, for example) mean bugs only have to be found once – this can free up tester to test other parts of the system – they don’t need to retest
6. Functional tests can prove that the code thats been written matches the requirements – in fact, all tests should be traceable to a requirement. How does this help quality? Well, if all the tests map to specific requirements, then it follows that all requirements map to tests. By knowing what the tests are that need to pass for a requirement to be considered delivered, the developer then knows, more clearly, what’s expected. And also when to stop…
There’s so many more reasons that testing is important, of course, but lets look at the second thing: peer review.
Peer reviewed code will be of better quality than non peer reviewed code because…
1. You’ll have to peer review against something (eg. coding standards) – programmers have a clearer idea of what’s expected
2. Programmers will either be proud or embarassed of their code – over time, training and guidance should make all programmers proud of their code
3. Peer review spreads knowledge of the codebase to the other developers
4. Peer review can find defects or poor practice, and can promote good practice
In fact, there’s lots of way peer review helps with quality. Pair programming is the most intimate form of peer review, but there’s always room for things to be checked.
Testing will not find things that peer reviewed code will find – for example, a previous post talked about technical debt.
Testing and peer review are essential in writing quality code. If you are working in an agile software development methodology, and you have not specified how you will (a) test, and (b) review, then your code will not be of good quality. (Okay, maybe your code will be, but what about the new boy whos just started?)
If you search for “agile” on Google, you’ll find loads of websites telling you about the improvements to the software lifecycle that can be gained by adopting an agile methodology. It seems like everyone’s becoming a Certified Scrum Master, or wants to sell some mentoring or training on how to “adopt agile” in your organisation.
I have a few thoughts on this:
- Agile methodologies are probably the best way to produce software that a customer wants
- Most agile methodologies are management processes – they do not specify how code should be written
I must say that some agile methodologies do not fail on point 2, for example XP specifies how code should be written, which is good in my opinion. Other agile methodologies – Scrum, for example – are very much management processes. They introduce nothing to help improve code quality, they focus entirely on requirements elicitation and workflow.
Specific practices need to be brought into a Scrum team to ensure code is written to a high standard – my worry for agile is that these “Certified Scrum Masters” are focussing too much on the process, and missing the 2 basic principles in software engineering:
- Write the correct software
- Write the software correctly
Scrum only helps with writing the correct software – it ensures the requirements are current, and the project owner is kept in the loop. It also helps the project manager to plan, which means they can create nice diagrams. And project managers love diagrams.
How does Scrum help with the second thing? How does Scrum ensure that the software is as beautifully crafted as it can be? It doesn’t… it’s up to the team that adopts Scrum to ensure the programmers have some controls in place to handle this.
So, if you are adopting an agile methodology, and also want to write software correctly, (that is to write software which is of a high quality and is easily maintainable), make sure your methodology recommends that your programmers (at least):
- Write tests (for bonus marks, write automated tests)
- Peer review code
Write Tests
Having tests improves quality because…
- It’s pretty obvious isn’t it? Do i need to write a list?… okay:
- Unit tests (for example, tests written using NUNit) prevent new code breaking existing code
- Unit tests make refactoring safer, which should encourage refactoring, and refactoring creates a cleaner design over time, which helps with many things i won’t go in to here
- Unit tests, when written to highlight a bug, can prevent regressions of the same bug
- Functional tests (when automated – tests written in Selenium, for example) mean bugs only have to be found once – this can free up tester to test other parts of the system – they don’t need to retest
- Functional tests can prove that the code thats been written matches the requirements – in fact, all tests should be traceable to a requirement. How does this help quality? Well, if all the tests map to specific requirements, then it follows that all requirements map to tests. By knowing what the tests are that need to pass for a requirement to be considered delivered, the developer then knows, more clearly, what’s expected. And also when to stop…
There’s so many more reasons that testing is important, of course, but lets look at the second thing: peer review.
Peer Review
Peer reviewed code will be of better quality than non peer reviewed code because…
- You’ll have to peer review against something (eg. coding standards) – programmers have a clearer idea of what’s expected
- Programmers will either be proud or embarrassed of their code – over time, training and guidance should make all programmers proud of their code
- Peer review spreads knowledge of the codebase to the other developers
- Peer review can find defects or poor practice, and can promote good practice
In fact, there’s lots of way peer review helps with quality. Pair programming is the most intimate form of peer review, but there’s always room for things to be checked.
Testing will not find things that peer reviewed code will find – for example, I posted previously about technical debt.
So what to do?
Testing and peer review are essential in writing quality code. If you are working in an agile software development methodology, and you have not specified how you will (a) test, and (b) review, then your code will not be of good quality. (Okay, maybe your code will be, but what about the new boy who has just started?)
I focussed on 2 areas which can improve code quality – there are other things that can be done too of course.
Agile is very important in ensuring that the software which is delivered is relevant to the needs of the customer – just be sure that the methodology you follow has the same care over the codebase as it does over the process.