m÷l

C├│mo bŠta the gŠ­i af hans hugb˙na­ur Hluti 2


Hugdetta básicos


Fyrstur af allur revisaremos sumir hugdetta b├ísicos hver sem af einhverju stafar e­a hlřst nau­synlegur eiga n˙tÝminn Ý r÷­ til fa­mur the vandrŠ­i hver t├şpicamente sig frambŠrilegur ß me­an the kryfja og umrita Ý dulmßl af hugb˙na­ur og c├│mo til leysa.

Hugb˙na­ur uppbygging


Hana hugb˙na­ur uppbygging stinga upp ß the vera Ý af ■rÝr tegund af uppbygging af stjˇrna: secuencial, sem einkennist af vali ( skilor­sbundinn) og endurtekning ( krulla); af the kryfja ni­ur ß vi­ og af fjßrmßl samantekt, eins og helmingur hver h˙n leyfa skrifa lausnarlei­ “ mßtun”.

The kryfja ni­ur ß vi­ stinga upp ß, b├ísicamente, hana deilanlegur af the vandrŠ­i hver sig h˙n vilja leysa ß undir- vandrŠ­i m├ís unostenteratious. Einn r÷­ af hreinsun samfelldur af the vandrŠ­i upprunalegur h˙n ÷kufer­ ß the sÚrstakur af einn stigveldi af undir- vandrŠ­i hver descienden Ý hana sta­a af ˇhlutstŠtt hugtak, ■anga­ til Ý hana sta­a af fßtŠkur gŠ­i hana h˙n leysa upphßr sokkur einn tungumßl af hugb˙na­ur Štti vera smßvŠgilegur.


Hana grind Ý andlit sřnishorn hluti af the stigveldi ß the hver sig a­greindur a vandamßl. ═ hana einn geta ˙tsřni c├│mo hana hugb˙na­ur beygla og uppbygging stinga upp ß, upphßr sokkur the kryfja ni­ur ß vi­, einn vera Ý nßtt˙ru- af the ˇhlutstŠtt hugtak ( hver oft sig umtal the hana bˇkmenntir eins og " fjßrmßl samantekt"). ┴ millibil af sta­a af the stigveldi af undir- vandrŠ­i framsetning einn h˙n leysa samantekt ß the vandrŠ­i upprunalegur. TIL mßl hver sig desciende Ý the the hlutfall af the stigveldi, desciende the sta­a af ˇhlutstŠtt hugtak me­ the lřsa Ý hana h˙n leysa og vi­ ■a­ ert birtast m├ís undir- vandrŠ­i.

Hana hugb˙na­ur uppbygging conlleva einn ■r÷ngur relaci├│n me­ hana hugb˙na­ur beygla.

Hugb˙na­ur beygla


Hana hugb˙na­ur beygla stinga upp ß hana deilanlegur af einn hugb˙na­ur ß eining af hugb˙na­ur sjßlfstŠ­ur hver ß the implementaci├│n sig convierten ß rutinas: framgangur, virka og m├│dulos ( vel heima Ý ├ęstos ├║ltimos eins og hljˇmplata hver flokkun virka og framgangur).

As├ş, Ý sta­ur af ■ekkja einstaklingur hluti af c├│digo upphßr sokkur tags og hafa a­gangur til til ■eir vi­ vegur af st÷kk ( dˇmur Ůvagsřrugigt), ├ęstos sig koma fyrir Ý hylki ß rutinas ( hann hver h˙n leyfa ˙tiloka a einhver fj÷ldi af galli og au­velda hana reutilizaci├│n) hver hefur nafnor­ ( hann hver h˙n leyfa bŠta hana sviprÝki af the c├│digo).

The kryfja ni­ur ß vi­ er hana t├ęcnica hver stinga upp ß draga ˙r hana flˇki­ e­li af the vandrŠ­i deila sÚrhver einn ß a lÝtill setja ailing m├ís unostenteratious. Esta t├ęcnica ( of ■ekktur eins og m├ętodo af hreinsun samfelldur) forsenda hver hana h˙n leysa ailing ekki smßvŠgilegur sig Štti bor­ upphßr sokkur hana sundrun ß vandrŠ­i m├ís lßtlaus, hver ß the sami tÝmi sig feyskinn dreifa ß annar a├║n m├ís lßtlaus, og as├ş sucesivamente ■anga­ til vera kosinn ß a sta­a af flˇki­ e­li vi­rß­anlegur. The hreinsun ■eir heill hvenŠr the vandrŠ­i ■a­ mega vera skřrt ■ekktur ■egar Ý sta­ ß a tungumßl af hugb˙na­ur uppbygging ( hana h˙n leysa er smßvŠgilegur), ■essi er, hver hana h˙n leysa sig h˙n nß til vi­ vegur af frumefni ■ekktur: gangur matem├íticas, lausnarlei­ og uppbygging af g÷gn af e­a snerta til hef­ og frumefni af the tungumßl af hugb˙na­ur kjˇsa.

Esta t├ęcnica gŠsla einn ■r÷ngur relaci├│n me­ the m├ętodo af sundrun ( minnkun e­a einf÷ldun) hver er com├║n lßta Ý tÚ Ý the matem├íticas Ý r÷­ til leysa jafna, hvers aflei­ing endanlegur it's a n├║mero e­a annars einn skipuleg framsetning irreductible ( l÷gun can├│nica e­a l÷gun venjulegur).

Eins og sig ver├í m├ís ß undan ), the stÝll af hugb˙na­ur uppbygging og beygla ■eir vi­urvŠri einn relaci├│n indisociable, Ý eins og mikill eins og the fullger­ur hver hana fremstur sig barnaherbergi s├│lo you're h˙n nß til af l÷gun mßtun sŠkja um of the t├ęcnicas tilbo­ vi­ the seinni.

Hugb˙na­ur beygla og uppbygging


Hana hugb˙na­ur beygla og uppbygging hefur eins og einn af hans undirst÷­uatri­i hana uses af ■rÝr tegund af uppbygging af stjˇrna hver ■eir skriflegt leyfi ÷­last the innstreymi af ger­.

Hana kynning af the uppbygging af stjˇrna leyfa gefa a heimanmundur ß the c├│digo af einn stˇr sviprÝki og lŠsileiki, a­ger­ m÷gulegur hver the forritari pudieran ßhald derivaciones af the innstreymi af ger­ vi­ vegur af estas ■rÝr uppbygging b├ísicas, Ý sta­ur til hafa samfarir sÚrhver einn til ■inn eiga skap handleika st÷kk. As├ş, the vera Ý af uppbygging af stjˇrna af the innstreymi af ger­ fyrir upp til the handfang ßstŠ­ulaus the vera Ý af dˇmur hver expl├şcitamente ßvextir og grŠnmeti st÷kk skilor­sbundinn e­a skilyr­islaus: sÚrstaklega af the dˇmur Ůvagsřrugigt.

En hana umsˇkn af uppbygging af stjˇrna og af annar hugdetta eins og the kryfja ni­ur ß vi­ og the fjßrmßl samantekt, hefur eins og takmark gefa a heimanmundur ß the aldur af hugb˙na­ur af vafalaust caracter├şsticas au­kennandi af gŠ­i hver the convierten ß lausnarlei­ “ mßtun”.

Einn lausnarlei­ “ mßtun” er hver sem er hver:

  • Hefur einn ├║nico benda innstreymi og einn ├║nico benda af byrjun.
  • Allur the dˇmur hver me­ ■˙ you're h˙n nß til ( ekki me­ ■˙ landshluti hver ekki alltaf sig ■eir kasta ˙t, of nefnari “c├│digo ”).
  • Ekki me­ ■˙ krulla ˇendanlegur.

Hana umsˇkn af the hugdetta af modularidad au­velda the fulfillment af the aukagjald caracter├şstica.

As├ş, einn lausnarlei­ mßtun Štti laga sig a­ einn rutina cuyas caracter├şsticas you're :

  • The c├│digo h˙n nß me­ hana skřring af lausnarlei­.
  • Hefur einn tengi ( e­a skilti), ■essi er hana ˙tnefna og hans par├ímetros formlegur, hver samrŠmi hana benda innstreymi.
  • Hefur einn benda af byrjun, hver er hana ├║ltima dˇmur, hver hefur eins og ßrekstur hana vÝkja til hli­ar af the innstreymi af ger­ ß the l├şnea af c├│digo hver h˙n fylgja ß the h÷gg.
Ůar a­ auki tÝmi, ■a­ er m÷gulegur hafa a­gangur til til allur rutina af c├│digo a­ger­ vera Ý af ■inn tengi ( einn h÷gg ß the hver sig jafn the par├ímetros konunglegur ■÷rf), Ý sta­ur af til hafa samfarir upphßr sokkur st÷kk expl├şcitos.

This of h˙n undirskilinn hver einn rutina ekki munu gir­ing st÷kk skilyr­islaus allt til annar rutinas e­a allt til the hugb˙na­ur helstur ( hana rutina Štti lj˙ka vi­- og- vi­ af ■inn ├║ltima dˇmur). Fyrir dŠmi, ekki munu gir­ing m├ís af einn dˇmur KOMA AFTUR ß a funci├│n e­a a­fer­.

RŠkja vi­urkenna the vera Ý af m├║ltiples dˇmur KOMA AFTUR ß a stjˇrna illa rutina.

Hugtakslegur einn funci├│n Štti koma aftur einn vir­i obligatoriamente fremur en vi­ munu ßvextir og grŠnmeti ßrekstur ve­. ═ koma aftur einn a­fer­ h˙n hjartarskinn skulda koma aftur ekki alltaf einn vir­i og ■a­ geta ßvextir og grŠnmeti ßrekstur ve­.

Einn ßrekstur ve­ it's a swapping ß the sta­a n˙tÝminn- dagur af the hugb˙na­ur, ■essi er, einn fjßrveiting ß a vera breytilegur cuya modificaci├│n ■rßkelkni vi­- og- vi­ af ß the tekjuhli­ fullger­ur hana ger­ af the rutina.

┴ RŠkja ekki hey ˇsamrŠmi Ý- ß milli til nota the or­ lokasteinn Virka, H┌N ┴GËđI e­a Undir. Allir rutina hver the nota ■a­ mega vera eins og mikill einn a­fer­ svo sem eins og ˇßkve­inn greinir Ý ensku funci├│n. Hvort hann piensa rÚttlßtur a mÝn˙ta, ver├í hver hann hver h˙n ˙tskřra hver einn rutina ■a­ mega vera einn funci├│n er hver devuelve einn vir­i, ekki hana or­ clave utilized in her declarations.

Shrimp neither she demands which on a funci├│n (seg├║n her definitions conceptual) itself I utilized:

RETURN {formulations} 

in as much as the type of data which itself declara in order to her refunds every time has one worth predefined.

Write software in the wake of esta t├ęcnica she allows which you may be f├ícilmente understandable (one quality indispensable in order to obtain software f├íciles of keep). Albeit, itself ought explore which the context in the which itself devise estas premise in the which itself fundamental the paradigm inflect and structure, it used to be of one wear ca├│tico and across-the-board of leaps conditional and unconditional.

Not hay nought intr├şnsecamente wicked at you, not ever him hubo in the leaps unconditional nor on the judgement GOUTY at particular. Albeit, the trouble surgieron of your wear ineligible and of your abuse, kind of which it can occur with any other element of one language of software whether itself she uses of moods inapropiados.

She observes which you're not awfully the differences in-between one leap at a rutina labeling and one knock at a rutina parametrizada (funci├│n or procedure):

  • One rutina labeling requiere the wear of changeful overall, while which one rutina parametrizada she utilizes his arguments and changeful local.
  • The changeful overall which itself they utilize on a rutina labeling it can to be confessed at any part of the software, while which the par├ímetros formal of one rutina parametrizada itself declaran together with she.
  • While which at at intervals of knock at a rutina parametrizada the values of his arguments they form part of the misma knock, at at intervals of leap to unto one rutina labeling the values of the changeful overall which ├ęsta she utilizes it can to be defined at any part of the software.
  • While which at the terminate her implementations of one rutina parametrizada the control of implementations return at the l├şnea which she follows to her knock, in the occurrence of one rutina labeling the control of implementations it can pop-up unto any part of the software.

Estas peque├▒as differences tuvieron, albeit, one shock highly significant on the quality of the software. Her shape correct of to use the leaps unconditional requer├şan which the programmer itself auto-impusieran various restrictions in order to her wear it might be tantamount to utilize rutinas parametrizables.

The leaps too itself they utilized in order to iteration one rutina and in order to derive the inflow of implementations of way conditional. Nonetheless, it is all about situations highly similar at the described formerly.

In order to the structures of control and the rutinas parametrizables they introduced her possibility of which the programmer derive the inflow of implementations of his software of shapes más controlled (kind of which it used to be perfectly possible utilizing leaps), but now of one shape más fácil.

Today at d├şa one language as Shrimp mantiene her judgement Gouty, but although is m├ís restrictive which her judgement GOUTY of the BASIC primal haven't occurrence utilize in order to implement curls or at replacement of functions and proceedings.

As of which at 1966 the cient├şficos computacionales Pen B├Âhm and Giuseppe Jacopini evince the theorem of the structure highly slowly itself they started to quit atr├ís the doubts at the wear of the structures of control.

Her vantage of write software fitting ser├şa which itself obtiene one style of software which har├şa possible utilize m├ętodos of checkups formal (although Shrimp not brinda facilities in order to to do it) and which itself have space for larger at the learning of other t├ęcnicas of software as the “dissect of software around indenture”.

Nonetheless, they exist circumstances espec├şficas in the which to use it can signify one levity upturn on the legibility of the rutina on the which itself they use or in her performance, and other circumstances in the which resulta non less than imprescindible the wear of judgements which producen leaps unconditional. For instance:

  • At the write one funci├│n usually come out necessary utilize at the minus one judgement RETURN in order to indicate the point of start and return one worth.
  • In the treatment of flaws often itself produce one leap unconditional as of her l├şnea which genera the flaw at the l├şnea which with you her judgement CATCH (located on the misma rutina or at other of the rutinas of the stack of calls), but resulta creature one mood highly downright of wield the exceptions.
  • The judgements BREAK and CONTINUOUS at doubtless circumstances they permit preclude her evaluations repetida of formulations conditional and by it one small upturn in the performance of the software: the programmer itself economized write various l├şnea of c├│digo and the software has one cost computations levemente lesser (although usually invaluable to naked eye).
  • The wear of the judgement RETURN at combinations with her judgement IF, at doubtless occurrences it can permit at the programmer express one algorithm of shape m├ís fleeting and cuya l├│gica is clearly obvious, although at the very tense her rutina she loses her quality of creature one algorithm fitting.

Her writing knurled of algorithms fitting is ├║til whether itself pretend to use alg├║n m├ętodo of checkups formal in order to evince which the software she attains with her specs (that is, which the algorithm quite she solves the trouble which itself I'd suppose ought solve, short the conditions foreseen) and which him ago without produce flaws.

The m├ętodo of checkups formal primal founded on the l├│gica of Hoare conlleva one labor-intensive work and consequently one tall cost, as a result usually not itself she utilizes. Albeit, the m├ętodo of shunt of software of Dijkstra (founded in the of Hoare) and other later as the dissect around indentures you're m├ís obtainable.

Nonetheless, the m├ętodos m├ís outspread in order to her prevenci├│n, discovery and corrections of flaws itself founded at tests unitarias, tests of regressive, of integration and of approvals, and at t├ęcnicas as “write the tests prime” (she testifies first) of the metodolog├şa Ultimate Programming.

At closures, her writing of software fitting not ago da├▒o (not whether itself they utilize accordingly the notions of POO, notably the polimorfismo), him which added at a non of experimentations she allows uncover those occurrences in the which the wear of judgements which producen leaps unconditional resulten advantageous.

At that time, one can take as pattern which the directions which producen leaps unconditional of shape limited, itself they owe utilize ├║nicamente when resulte highly downright which facilitation her comprensi├│n of the c├│digo. Exploraremos you change of these situations in the out of the way Re-factorizaci├│n.




gravel

The binomial TRY CATCH

I think that in this párrafo estás talking of Java in lieu Shrimp :-)

Greetings.

Julius

The comments están habilitate in order to the lecturers it can participate on the corrections of the book, implement questions on time or suggestion. Lock, stock and barrel remark outside these objectives será eliminated. Please, tenga at tally him subsequent:

- She attains the standards full-dress.

- I achieved cr├şticas constructive.

- Don't be repetitious.