code metrics

16
Code Metrics -Albert-

Upload: -

Post on 28-Nov-2014

275 views

Category:

Documents


6 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Code metrics

Code Metrics-Albert-

Page 2: Code metrics

Code metrics ?Code metrics is a set of software measures that provide

developers better insight into the code they are developing.

Page 3: Code metrics

platohttps://github.com/es-analysis/plato

Javascript Source Code 분석툴

Page 4: Code metrics

Installnpm install -g plato

Page 5: Code metrics

runplato -r -d report src

Page 6: Code metrics

Lines of code

Maintainability

Estimated errors

Page 7: Code metrics

Complexity

Estimated Errors

Source lines of code

Difficulty

Page 8: Code metrics

Maintainabilityindex(0~100) = 171 - 5.2 * In(Halstead Volume) - 0.23 *

(Cyclomatic Complexity) - 16.2 * In(Lines of Code)

Page 9: Code metrics

Halstead complexity measures

operators, operands => program length, volume, difficulty, effort, bugs

Page 10: Code metrics

Volume & Erros (Halstead)

Volume = total x log2(distinct) Bugs = Volume / 3000

Page 11: Code metrics

Cyclomatic Complexitythe number of linearly

independent paths

Page 12: Code metrics

뽀오나쓰~

Page 13: Code metrics

Coupling모듈간의 의존도 또는 연관 관계 (낮을 수록 좋은거)

Page 14: Code metrics

CouplingMessage Coupling : 상태 없음, 메시지나 파라미터를 통해서 통신

Data Coupling : 두 모듈 간에 파라미터로 작은 데이터만 공유

Stamp Coupling : 자료 구조를 공유

Control Coupling : 한 모듈이 정보를 전달함으로써 다른 모듈의 플로우를 제어

External Coupling : 외부로 노출된 프로토콜, 디바이스 인터페이스를 공유

Common Coupling : 두 모듈이 같은 데이터를 공유 (전역 변수)

Content Coupling : 다른 모듈의 내부 기능 및 자료를 변경

Page 15: Code metrics

Cohesion한 모듈 내에서 요소들 간의 연관성 (높을 수록 좋은거)

Page 16: Code metrics

CohesionFunctional Cohesion : 잘 정의된 한 기능이 하나의 모듈을 이룸

Sequential Cohesion : 모듈 내 한 작업의 출력이 다른 작업의 입력이 됨

Communication Cohesion : 같은 데이터를 다루는 것들을 묶음

Procedural Cohesion : 특정 실행 순서를 따르는 것들을 묶음

Temporal Cohesion : 특정 시간에만 수행되는 것들을 묶음

Logical Cohesion : 논리적으로 같은 일들을 하는 것들끼리 묶음

Coincidental Cohesion : 아무 관계 없는 처리 요소들을 묶음 (유틸리티)