This site uses cookies.
Some of these cookies are essential to the operation of the site,
while others help to improve your experience by providing insights into how the site is being used.
For more information, please see the ProZ.com privacy policy.
Freelance translator and/or interpreter, Verified site user
Data security
This person has a SecurePRO™ card. Because this person is not a ProZ.com Plus subscriber, to view his or her SecurePRO™ card you must be a ProZ.com Business member or Plus subscriber.
Affiliations
This person is not affiliated with any business or Blue Board record at ProZ.com.
Source text - English Examine the previous code. What on earth is that code doing? Upon a cursory glance, it is easy to tell that four variables are being assigned values, and then some arithmetic is performed and the result assigned to another variable. But one critical piece of information is missing: what the variables represent. Consider the following code snippet:
$pos_start = 0; // Distance in yards
$pos_final = 128;
$time_start = 0; // Time in seconds
$time_end = 64;
$ball_velocity = ($pos_final - $pos_start)/($time_end - $time_start);
Now it becomes obvious that the routine is calculating the velocity of something measured in yards per second. The code with the vague, intimidating variable names would probably give anyone nightmares.
It can also become quite cumbersome to use names that are too verbose. Consider the following name NumberOfCharactersInThisDocument. The name obviously and exactly describes what the variable will contain. However, typing that three or four times would become burdensome at best.
Make sure that your variable names accurately describe the variable’s contents so that you will remember yourself what the variables mean a few months later! Table 2.1 presents some examples of variables named properly and the same data represented with incoherent variable names.
Translation - Lithuanian Panagrinėkime pateikto PHP kodo pavyzdį. Ką jis daro? Iš pirmo žvilgsnio lengvai galime pasakyti, kad keturiems kintamiesiems suteiktos reikšmės, po to atliktas matematinis veiksmas, kurio rezultatas priskirtas dar kitam kintamajam. Trūksta esminės informacijos: kokius duomenis atspindi kintamieji. Įsižiūrėkite į šią kodo ištrauką:
$pos_start = 0; // Atstumas jardais
$pos_final = 128;
$time_start = 0; // Laikas sekundėmis
$time_end = 64;
$ball_velocity = ($pos_final - $pos_start)/($time_end - $time_start);
Akivaizdu, kad programa skaičiuoja kažkieno greitį jardais per sekundę. Kodas, naudojantis miglotus, neaiškius kintamųjų vardus, tikriausiai gali sukelti košmarus.
Kita vertus, kodas gali tapti pernelyg gremėzdiškas, jei vartojami daugiažodžiai vardai. Pažvelkite į vardą NumberOfCharactersInThisDocument. Šis vardas visiškai ir tiksliai nusako kintamojo turinį. Tačiau jo rašymas tris ar keturis kartus, geriausiu atveju, taps varginantis.
Pasistenkite, kad jūsų kintamųjų vardai tiksliai atspindėtų turinį ir kintamųjų reikšmių nepamirštumėte per keletą mėnesių. 2.1 lentelėje pateikti teisingai ir neadekvačiai sudaryti kintamųjų, atspindinčių tą patį turinį, vardai.
More
Less
Experience
Years of experience: 23. Registered at ProZ.com: Sep 2004.
Adobe Acrobat, Adobe Photoshop, Microsoft Excel, Microsoft Word, ABBYY FineReader, Adobe Acrobat, Adobe Photoshop, MS Office Excel, MS Office PowerPoint, MS Office Word, Rhino 3D, Studio 2011, Win Rar, WinIso, WinZip, Powerpoint, SDLX, Trados Studio, Translation Workspace