Seeing is believing
René Schwietzke, Xceptance
The big picture about this lecture.
Feel free to ask any question, anytime.
To be honest, this is more of a change review training than a code review training. There are often changes that are unrelated to Java or coding details.
...but code review sounds cooler.
The High-Level View
Code review is systematic examination of computer source code. It is intended to find and fix mistakes overlooked in the initial development phase, improving both the overall quality of software and the developers' skills. Reviews are done in various forms such as pair programming, informal walkthroughs, and formal inspections.
http://en.wikipedia.org/wiki/Code_review
No programmer? No problem!
Therefore it is a change review, not a code review.
Less talking, more doing!
How and where to review
Use any tool you find useful.
Some first things to configure
Your preference might be different.
How to approach the review.
Squashing is not preferred and I will make the case soon.
Just a list for now.
Always ask if something is fishy.
https://stash.lab.demandware.net/projects/ECOM/repos/server/pull-requests/1864/
No tests, no fun.
Does the customer API change and how.
Rather ask three times or more...
Does make the context sense?
You touch it, you own it!
Does the code or file look pleasant?
This mostly means war!
This is inline documentation, because the outside documentation might get lost or out of date pretty soon.
http://stash.lab.demandware.net/projects/ECOM/repos/server/pull-requests/2469/diff#source/bc_impex/javasource/com/demandware/component/impex/pipelet/CreateSite.java
Any SQL, any migration?
http://stash.lab.demandware.net/projects/ECOM/repos/server/pull-requests/2469/diff#source/migrate/appserverinstance/system/resources/migration/15.4.xml
Our servers are multi-threaded.
Anything that is assumed to be there or in a range.
Reworking the code to fit in something new.
The reason for the change determines the code review depth.
Different than the surrounding code.
http://stash.lab.demandware.net/projects/ECOM/repos/server/pull-requests/2056/diff#source/core/javasource/com/demandware/beehive/core/capi/request/Session.java
Incorrect code to deactivate it.
http://stash.lab.demandware.net/projects/ECOM/repos/server/commits/58cefd15acd69b45fa68915ac57948d4efee1fee
Logic nightmares.
Important for code coverage as well.
org.junit.Assert
/**
* Test adding the same data again
*/
@Test
public void addHandlingDuplicateData()
{
final String A = "foo1";
final String B = new String("foo1");
// this is the string challenge :)
Assert.assertNotSame(A, B);
Assert.assertEquals(A, B);
final ArrayList list = new ArrayList();
Assert.assertEquals(0, list.size());
}
If you cannot assert it, you cannot test it.