Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

43
Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding

Transcript of Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Page 1: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Alcatel-Lucent CDCWorkshop, Coaching & Knowledge Transfer

Coding

Page 2: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Metrics & Kpi’s

Page 3: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Quantify your processes

Build information Versioning information Code analysis Genesis information Operational metadata

Page 4: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Benefits of quantification

(Implicit) measurement of development quality

leads to optimization Individual developers Group processes

control your development process

Establish SLA’s with third parties!

Page 5: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Visualize your metrics

Use simple and easily accesible representations Genesis, Glance, charts

Page 6: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Use metrics wisely

As always ... Just the numbers are not enough Build kpi’s based on combined metrics Keep the ‘common sense’

Page 7: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.
Page 8: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

What

Data analysis architecture Enables visualization of development process

data Cube explorer KPI browser Reporting engine

Page 9: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Benefits

Fast feedback Metrics over time

measure evolution enables optimization

Central repository Combine project metadata and operational data leads to very detailed view on development

process

Page 10: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Architecture

AMO

CRM / HRM

Warehouse(Glance)

SQL Server 2005 Database Services

SQL Server 2005 Integration Services

SQL Server 2005 Analysis Services

Glance

R- H- OLAP Partitions

Write-back Partitions

ROLAP / Write-back Data

MOLAP Partitions

KPI’s (UDM):

- AgingInvoices- Project Profitability- Leave Hours- ...

Actions: (drillthrough)

- GetInvoiceNumbers- ...

Perspectives:

- Invoicing- HRM- CRM- ...

BA

CK

EN

D

Security(Integrated – LDAP link)

CRM / HRM / ...

BUSINESS TIER

DATA ACCESS TIER

AdminPerformance View

(RBM)

ADO.NET ADOMD.NET

FR

ON

T E

ND

BUSINESS TIER (WCF)

DATA ACCESS TIER

Reveal

Daily + partial ‘Real-time’ sync (issue tracking, …) Ad Hoc is also possible Daily; after

successful ETL

(to consult Real-time data)ETL

Reprocess Cube

Cube Browser

Other sources: Genesis, Source

Control, ...

ETL

KPI Config, ... Glance

Maintain Cube

SSIS Package, scripts, ...

KPI Configand parameters

(Glance)

Page 11: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Glance

Page 12: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Short & Long Term Benefits

Page 13: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Short & Long Term Benefits

Short term Optimize quality per project

Long term Install a true software factory

Uniform processes, metrics, delivery

Overall : SAVE MONEY

Page 14: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Getting Started

In Your Own Environment

Page 15: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Source Control

Centralized code repository Easy accessible code through check-out /

check-in Subversion, CVS, Team Foundation or any

other alternative

Page 16: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Tools

Testing Framework (Nunit) Mocking Framework (Rhino Mocks) IoC Container (Castle Windsor) Build Server (Team City) Genesis

Page 17: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Continuous Integration

Page 18: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Continuous Integration

Triggered by changes in the code repository Builds almost every check-in Steps

Get latest code Builds a new version Runs tests Runs genesis Packages a new version Generates reports

Page 19: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Project Dashboard: EMS

Page 20: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Project Dashboard: EMS

Page 21: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Project Dashboard: Reports

Page 22: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Refactoring

Page 23: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

One step beyond…: Refactoring

Now that we have a good set of test and a good way to follow up on things, let’s go one step further: improve the quality of our code.

Page 24: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Refactoring

Let’s explain WHY we should refactor Let’s explain WHAT refactoring is

Page 25: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Why refactor

A machine is NOT the only one that needs to understand your code…… your colleague and even yourself in a few months time should too!

That’s why YOU should write high quality code, that is readable, understandable and maintainable……by using refactoring techniques…

Page 26: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Why refactor

Improves the design of software Makes software easier to understand Helps in finding bugs Helps in programming faster

Page 27: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

What is refactoring?

Martin Fowler: “Refactoring is a disciplined technique for

restructuring an existing body of code, altering its internal structure without changing its external behavior.”

Page 28: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

What is refactoring?

Its heart is a series of small behavior preserving transformations. Each transformation (called a “refactoring”) does little, but a sequence of transformations can produce a significant restructuring.

Page 29: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

What is refactoring?

Since each refactoring is small, it's less likely to go wrong. The system is also kept fully working after each small refactoring, reducing the chances that a system can get seriously broken during the restructuring.

Unit tests!!!

Page 30: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

How to refactor

Find a code smell Code that stinks Bad code

Refactor it using refactoring methods

Code smell Refactor

Page 31: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

How to refactor

Refactoring is a continuous process “Add function” OR “Refactor”. Change hats!!

Add Function

Refactor

Page 32: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Code smells

Parts of the code that “stink” Parts of the code that need refactoring Most important code smells

Duplicate code Long methods Large classes

Page 33: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

The tight link with unit testing

How are unit tests involved in refactoring? It’s easy: How can you change your code

without knowing you break something??? Thus: refactoring is only possible when you

have a good set of unit tests, ensuring you that you do not break anything while improving it.

Page 34: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Refactoring

The Holy Bible www.refactoring.com

Golden advice: Buy the book and read it! It will change your life as a

developer!!

Page 35: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Duplicate code: problem

Some code is needed in more than 1 place The easiest way, at first sight, is to copy-paste

the code This results in bad maintainability: if this code

has to change, it has to be changed in multiple places

It’s likely to forget to change some parts so bugs are introduced easily

Page 36: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Duplicate code: solution

Same code in multiple methods in same class: Extract method

Same code in multiple methods in subclasses: Extract method in both classes and Pull up method

Same code in unrelated classes: Extract class and use this class in both methods

Page 37: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Long method: problem

Long methods are hard to understand Long methods are hard to maintain Long methods are susceptible to bugs

Page 38: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Long method: solution

Replace long method by calls to other “private” methods

Use Extract method to create delegation to smaller methods

Page 39: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Large class: problem

Classes that try to do too much Each class must have its own responsibility

Page 40: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Large class: solution

Use Extract class Use Extract subclass

Page 41: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Refactoring: practical

Visual Studio Solution: ItemSolutions.Refactoring

Page 42: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Questions

Any questions about the “Refactoring”?

Page 43: Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.

Contact

Item SolutionsPlantin en Moretuslei 1552140 Borgerhout +32 3 236 64 03 [email protected]

SpeakerKristof Rennen [email protected]