Food for thought (was: Re: jsp vs php)

Giorgos Keramidas charon at labs.gr
Sat Oct 20 01:37:01 EEST 2001


Yannis Kotsinos <zookie at med.auth.gr> wrote:
> Etsi kai esy den eisai anagkasmenos na eleg3eis gia treis xiliades
> parametroys px. alla mporeis apla na "piaseis" ena exception
> (analogo synh8ws me to ti kanei h me8odos poy dhmioyrgeis. px mia
> me8odos se java poy diabazei ena arxeio einai poly pi8anon na
> "peta3ei" ena IOException.) Gia perissotera, pragmatika kalytera na
> katafygeis se ena biblio :-)

Ekei pali exeis problhmata pou o programmatisths prepei na exei
'peira' gia na ta xeiristei omws, afou akomh den jero an kwdikas pou
kanei panw apo ena pragmata pou exoun kapoiou eidous dependency to ena
apo thn epituxia / apotuxia tou allou, prepei na grafetai etsi:

	try {
		DoThis();
	} catch (Exception e) {
		// handle exceptions for DoThis();
	}

	try {
		DoThat();
	} catch (Exception e) {
		// handle exceptions for DoThat();
	}

h etsi:

	try {
		DoThis();
		DoThat();
	} catch (Exception e) {
		// handle all exceptions for DoThis() and DoThat()
	}

Auto fusika arxizei kai ginetai akoma pio enoxlhtiko otan milame gia
programmata pollwn xiliadwn grammwn, pou den einai duo mono ta
pragmata pou exoun kapoiou eidous ejarthsh to ena apo thn epituxh h
oxi oloklhrwsh tou allou.

H gia na kano ta pragmata akoma pio asxhma, se ena call tree opws to
parakatw ...

	main
	+-- DoThis
	|   `-- DoThat
	+-- DoSomething
	    `-- DoSomethingElse
	        `-- DoEvenMore

... an ena exception energopoih8ei sto DoThat() h sto DoEvenMore()
poios tha to xeiristei auto to exception?

Ki an h main() den xeiristei kapoio exception mias apo tis functions
pou klh8hkan kai auto to exception pernwntas olo kai pio pshla sto
call-stack tou programmatos ftasei sthn main() alla telika fanei oti
den exei kapoio handler autou tou exception h main(), ti ginetai?
Kremaei olo to programma, kai petaei to gnosto mas core dump, h oxi?

Ki an termatisei to programma, alla einai critical efarmogh pou den
prepei na kleisei gia pano apo kapoia deuterolepta (h klasmata tou
deuteroleptou), anejarthtws exceptions?  Tote ftaiei o programmatisths
pou den sxediase kala to programma tou?  Kai auto poso diaforetiko
einai apo thn eu8unh pou exei enas programmatisths na koitazei ola ta
return values se mia procedural non-object-oriented glwssa (opws h C
gia paradeigma)?

-giorgos




More information about the Linux-greek-users mailing list