jsp vs php
Yannis Kotsinos
zookie at med.auth.gr
Fri Oct 19 12:06:00 EEST 2001
Antonis Kanavouras <ankan at med.auth.gr> says:
>Yannis Kotsinos wrote:
>>
>> : [Αν το point σου είναι το error handling, τότε είναι C vs C++ war...]
I did'nt write that :-)
(to attribution oso yperboliko mporei na soy fainetai ayto einai poly
shmantiko na ginetai swsta. Orismenes fores ena la8os quote mporei na
einai xeirotero apo no quote at all)
>Ayto pou ennow egw error handling einai ey8ynh tou tou programmatisth,
>oxi ths glwssas. Mou diafeygei kati?
Ta built in ~'ergaleia' me ta opoia ginetai ayto to handling an mporw
na to pw etsi. Se procedural languages san th C den yparxei exception
handling. Etsi einai ka8ara ey8ynh (alla kai peira) toy
programmatisth na elegxei ta retrurn values twn function toy (bug
prone -- 8elei poly prosoxh, humans make mistakes 8a elege kai o HAL).
H gia na sto 8esw alloiws an exeis mia me8odo poy kalei mia allh
me8odo, h caller me8odos den 8a eleg3ei to validity twn return values
ths called ektos kai an esy pros8eseis sygkekrimeno kwdika gia kati
tetoio. Ayto mporei na einai aplo gia polles periptwseis alla oso
ay3anetai h periplokothta toy programmatos einai poly pio pi8ano na
paraleif8ei kati. To exception handling anti8eta anagkazei thn caller
methodo na ele3ei gia pi8ana la8h, kai an den mporei h idia na ta
xeiristei na ta perasei sthn amesws prohgoymenh, mexri fysika na
bre8ei kapoia gia na ta xeiristei. 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 :-)
An 8eleis kapoio starter reference des ayto:
url:
http://www.oreillynet.com/pub/a/dotnet/2001/09/04/error_handling.html
======================================================
Most older programming languages, such as C and Basic, rely on the
heavy use of if statements to detect if an error has occurred. As
programs become bigger and more complicated, this approach to that
kind of error handling creates more and more insomniacs in the
computer programmer profession. Creating robust and reliable large
applications is also exponentially more difficult as the number of
lines of code increases. More modern programming languages, such as
C++, Java, C# and VB.NET, base their error-handling strategy on code
isolation. Part of the code that could potentially lead to an error is
isolated in a block, and should an error occur, this error is caught
and handled locally. This approach seems to work satisfactorily. No
more if statement to check the returned value of a function, no more
branching that can turn your code into a spaghetti mess.
======================================================
(pantws gi' ayto kai oi 'palioi' lene oti prwta skeftesai ti 8eleis na
kaneis kai meta dialegeis poia glwssa einai kalyterh)
>Antonis
hth.
"We are a generation raised by women.I'm
wondering if another woman is the answer."
More information about the Linux-greek-users
mailing list