Cov txheej txheem:

McCabe tus lej yog dab tsi?
McCabe tus lej yog dab tsi?

Video: McCabe tus lej yog dab tsi?

Video: McCabe tus lej yog dab tsi?
Video: Jain - Makeba (Official Video) 2024, Plaub Hlis Ntuj
Anonim

(Alias: McCabe tus lej )

Qee tus tuaj yeem zam tau. McCabe cov cyclomatic complexity yog software zoo metric uas ntsuas qhov nyuaj ntawm software program. Complexity yog inferred los ntawm kev ntsuas qhov tus lej ntawm linearly ywj siab paths los ntawm qhov kev pab cuam. Qhov siab dua tus lej qhov ntau complex code.

Tsis tas li ntawd, McCabe tus lej suav li cas?

Yuav ua li cas xam Cyclomatic Complexity (McCabe)

  1. P = tus naj npawb ntawm qhov cuam tshuam ntawm cov kab hluav taws xob ntws (piv txwv li kev hu xov tooj thiab cov txheej txheem subroutine)
  2. E = tus naj npawb ntawm ntug (hloov tswj)
  3. N = tus naj npawb ntawm cov nodes (ib pawg ntawm cov nqe lus uas tsuas muaj ib qho kev hloov ntawm kev tswj)

Ib yam li ntawd, tus lej cyclomatic suav li cas? Kev suav ntawm Cyclomatic Complexity:

  1. E = sawv cev rau tus naj npawb ntawm cov npoo hauv kev tswj cov kab kos = 11 npoo.
  2. N = sawv cev rau tus naj npawb ntawm cov nodes nyob rau hauv kev tswj flow graph = 11 nodes.
  3. P = sawv cev rau tus naj npawb ntawm cov nodes uas muaj cov ntsiab lus tawm hauv kev tswj hwm cov duab kos = 1 qhov chaw tawm.

Ntawm no, tus lej cyclomatic yog dab tsi?

Los ntawm Wikipedia, dawb encyclopedia. Cyclomatic complexity yog software metric siv los qhia qhov nyuaj ntawm qhov program. Nws yog ib qho kev ntsuas quantitative tus lej ntawm linearly ywj siab paths los ntawm ib qhov kev pab cuam qhov chaws code. Nws yog tsim los ntawm Thomas J. McCabe, Sr.

Dab tsi yog cyclomatic complexity thiab vim li cas nws tseem ceeb?

Testability thiab kev ruaj ntseg yog tseem ceeb vim lawv siv sij hawm feem ntau nyob rau hauv txoj kev loj hlob lub neej voj voog ntawm cov khoom. Cyclomatic complexity feem ntau yog siv los ntsuas qhov nyuaj nyob rau hauv chav kawm lossis theem txheej txheem.

Pom zoo: