42
5/18/22 www.ExigenServices.com CHASING CODE QUALITY IN HUGE MULTI- LOCATION TEAM PROJECT

Chasing code quality in huge multi-location team project

Embed Size (px)

DESCRIPTION

Sigis Jermolovicius Chasing code quality in huge multi location team project

Citation preview

Page 1: Chasing code quality in huge multi-location team project

April 9, 2023 www.ExigenServices.com

CHASING CODE QUALITY IN HUGE MULTI-LOCATION TEAM PROJECT

Page 2: Chasing code quality in huge multi-location team project

2 www.ExigenServices.com

GLOBAL EXIGEN SERVICES

EuropeEastern Europe

US

RigaR&D Center

VilniusR&D Center

Asia-PacificWuxiR&D Center

SuzhouR&D Center

London

Frankfurt

New YorkSan FranciscoHeadquarters

San Paulo

Christchurch

Johannesburg

KazanR&D Center

Nizhniy NovgorodR&D Center

St. PetersburgR&D Center

MinskR&D Center

OdessaR&D Center Dnepropetrovsk

R&D Center• Founded in 2000• 1’500 professionals• Revenue approx.

$70M

Adelaide

Page 3: Chasing code quality in huge multi-location team project

3 www.ExigenServices.com

EXIGEN SUITE COMPONENTS

3rd Party Interface

BillingInterface

ClaimsInterface

Commission Interface

Self-Service Portal Interface

Reinsurance Interface

Analytics Interface

3rd Party Mgmt

Accounts & CRM

CorrespondenceManagementSub-LedgerReporting &

Compliance Tasks &

Decisions

Document Generation

Configuration & Scheduling Security Process &

Task MgmtBusiness Activity

MonitoringContent

ManagementBusiness

Rules

CommonServices

Data & Sys Integration

Operations Management

New Business

Policy Servicing

Claims Financials

Claim Processing

BusinessProcesses&Core Functions

New Business

Rating

Policy Servicing

Adjudicaton & Settlement

Claim Financials

FNOL

Claim Processing

ProductManagement

Under-Writing

POLICYCORE CLAIMCORE

Payment Processes

Payment Management

Invoice & Collection

Bill Plan Management

BILLINGCORE

PRODUCT FACTORY

Distribution Management Sales and Customer Service DISTRIBUTIONCORE

Page 4: Chasing code quality in huge multi-location team project

4 www.ExigenServices.com

WHEN YOU START FAILING

Agile works says: One location, team, scrum master and product owner Everybody are universal and senior;

But in sometimes we have Multi location, teams, scrum masters and PO’s And mixed level;

And here problems arise.

Page 5: Chasing code quality in huge multi-location team project

5 www.ExigenServices.com

THIS PRESENTATION TOPIC

Stable Continuous Integration

Effective Code review

Useful Static code quality

Page 6: Chasing code quality in huge multi-location team project

6 www.ExigenServices.com

TECHNOLOGIES WE SELECTED

Source control (DSVC) - hg (Mercurial) mercurial.selenic.com

Build tool - Jenkins jenkins-ci.org

Review tool - Reviewboard reviewboard.org

Static code quality - Sonar sonarsource.org

Page 7: Chasing code quality in huge multi-location team project

7 www.ExigenServices.com

STABLE CONTINUOUS INTEGRATION

Page 8: Chasing code quality in huge multi-location team project

8 www.ExigenServices.com

CI FOR ONE TEAM

Page 9: Chasing code quality in huge multi-location team project

9 www.ExigenServices.com

CI WITH MULTIPLE TEAMS

Page 10: Chasing code quality in huge multi-location team project

10 www.ExigenServices.com

WHAT TO DO?

Options

Fight with continuous integration failures every day

Fail fast. Setup your continuous integration to no accept failing code.

Page 11: Chasing code quality in huge multi-location team project

11 www.ExigenServices.com

FAILING FAST

“Failing fast” for development means getting response about your code quickly, from: compilerdeploymentunit and integration testUI testsstatic quality parameters

And all those answers should be given before code gets to source control.

Page 12: Chasing code quality in huge multi-location team project

12 www.ExigenServices.com

MULTIPLE TEAMS – MULTIPLE CONTINUOUS ENVIRONMENTS

Page 13: Chasing code quality in huge multi-location team project

13 www.ExigenServices.com

TEAM BRANCH

Page 14: Chasing code quality in huge multi-location team project

14 www.ExigenServices.com

BENEFITS

Team continuous integration environment is effected only by team changes.

Only finished and tested features will get to central. Gatekeeper would be responsible to merge.

Page 15: Chasing code quality in huge multi-location team project

15 www.ExigenServices.com

STILL TO BE IMPROVED

There is still possibility that gatekeeper will push bad code

We don’t reach our ultimate goal - STABILITY of central.

Page 16: Chasing code quality in huge multi-location team project

16 www.ExigenServices.com

ONE STEP FURTHER - TEAM-MERGE

To achieve our goal we created CI job that doesn't allow bad code. It does automatic code merge, compile, test and push.– rights write to central are revoked for anyone and only "special"

"team-merge" user can do merge.– only possible way to commit code from team-branch to central

is through "team-merge" script.

Page 17: Chasing code quality in huge multi-location team project

17 www.ExigenServices.com

HOW IT WORKS

Page 18: Chasing code quality in huge multi-location team project

18 www.ExigenServices.com

HOW TO START IT

Page 19: Chasing code quality in huge multi-location team project

19 www.ExigenServices.com

FINAL TIPS

Your environment should be stable enough to do this approach.

Better have small number of working test rather than huge number of failing test.

Each team has own CI plans – hardware is required

Page 20: Chasing code quality in huge multi-location team project

20 www.ExigenServices.com

EFFECTIVE CODE REVIEW

Page 21: Chasing code quality in huge multi-location team project

21 www.ExigenServices.com

CODE REVIEW OR NOT CODE REVIEW

Code review, if: – You plan long life cycle for your product– Your customer insist on high quality and you have maintenance

contract.

Don’t code review, if:– Your product has short life cycle (demos, POC, etc.)– You don’t care about maintenance after it’s done

Page 22: Chasing code quality in huge multi-location team project

22 www.ExigenServices.com

CODE REVIEW

There are various proposals on code review – Pair Programming

Review about do less than 100%, with rules, likeReview only Selected commits.Review only commits from juniorsRandom reviews

Review 100% of code

We chose 100% review.

Page 23: Chasing code quality in huge multi-location team project

23 www.ExigenServices.com

CODE REVIEW AFTER COMMIT

Guarantee that reviewed code is committed

No special actions required if reviewed code passes

Issues: In case code doesn’t pass you have bad code in repository until it’s

fixed. Bad code effects others

Page 24: Chasing code quality in huge multi-location team project

24 www.ExigenServices.com

CODE REVIEW BEFORE COMMIT

Review patches or review branch.

Bad code doesn’t effect others.

Issues: You have no guarantee that good code reviewed will get to

repository. As somebody needs to merge it.

What we needed is:

Automated merge on code review pass.

Page 25: Chasing code quality in huge multi-location team project

25 www.ExigenServices.com

100% CODE REVIEW

What we want is

1. Work as a team.

2. Review all code changes

3. Do not effect others

Therefore we need code review systems what would assure 100% review.

Other requirements: DVCS-backed review system Acts as a front end for to central DVCS-repo When review is complete auto merge with default branch

Page 26: Chasing code quality in huge multi-location team project

26 www.ExigenServices.com

CODE REVIEW TOOLS

For git users there is good tool called gerrit http://code.google.com/p/gerrit/

If you use mercurial (hg), it’s bit more complicated – as where is no analogue for gerrit for hg.

Our approach was to use reviewboard.org and mercurial enhanced with python scripts what are mimicking gerrit approach.

To initiate review you should call “hg postreview”

Page 27: Chasing code quality in huge multi-location team project

27 www.ExigenServices.com

REVIEWBOARD

Page 28: Chasing code quality in huge multi-location team project

28 www.ExigenServices.com

REVIEW CYCLE

Page 29: Chasing code quality in huge multi-location team project

29 www.ExigenServices.com

USEFUL STATIC CODE CONTROL

Page 30: Chasing code quality in huge multi-location team project

30 www.ExigenServices.com

CONTROL CODE QUALITY

We want to control basic parameters of code qualityStatic code violationCode unit and integration test coverageOther code parameters

We can do it effectively with tool called Sonar

Page 31: Chasing code quality in huge multi-location team project

31 www.ExigenServices.com

METRICS

What you want to measure? – Test Coverage?– Static code violations?– Code metrics?

Answer to this is SONAR

Automates metrics and creates reports.

Allows to analyze code to the code line details.

sonarsource.org

Page 32: Chasing code quality in huge multi-location team project

32 www.ExigenServices.com

SONAR PROJECT VIEW

Page 33: Chasing code quality in huge multi-location team project

33 www.ExigenServices.com

CODE COVERAGE

Page 34: Chasing code quality in huge multi-location team project

34 www.ExigenServices.com

CODE DRILLDOWN

Page 35: Chasing code quality in huge multi-location team project

35 www.ExigenServices.com

CODE VIOLATIONS

Page 36: Chasing code quality in huge multi-location team project

36 www.ExigenServices.com

VIOLATION DRILLDOWN

Page 37: Chasing code quality in huge multi-location team project

37 www.ExigenServices.com

WHAT’S NEXT WITH SONAR

Good is that we have tool to control

Bad is that what people are still people and tend to do crappy code.

number of violations is increasing.still repeating same errors.code is unmaintainable

Page 38: Chasing code quality in huge multi-location team project

38 www.ExigenServices.com

OUR APPROACH

Decide that violations are critical for you and what you can live with.

What we do: Using multistage commit we don’t accept code with blocker

violations. Commit is declined and developer should rework their code

before next commit. Use personal violations view to work with particular developers

coding style.

Page 39: Chasing code quality in huge multi-location team project

39 www.ExigenServices.com

PERSONAL VIOLATIONS DRILLDOWN

Page 40: Chasing code quality in huge multi-location team project

40 www.ExigenServices.com

PREVENT VIOLATIONS

Page 41: Chasing code quality in huge multi-location team project

41 www.ExigenServices.com

TIPS

Declare violations as critical first.

Allow teams to fix them.

Increase severity to blocker after all existing are fixed

Decline new violations of same type

Page 42: Chasing code quality in huge multi-location team project

42 www.ExigenServices.com

QUESTIONS?