Topic CrossConnect

Panos panos at linuxuk.com
Thu Oct 3 12:00:02 EEST 2002


>On Thursday 03 October 2002 10:42, Christos Ricudis wrote:
>
>> Bebaia, in a second thought, nomizw oti isws 8a protimousa to Hungarian
>> notation apo keinh th glwssa sthn opoia gia na kaneis aycto :
>>
>> if ((fp=fopen("file","r"))==NULL) return(1);
>>
>> grafeis :
>>
>> try {
>> 	File inputFile = new File("file");
>> 	FileInputStream inputStream = new FileInputStream(inputFile);
>> } catch (FileNotFoundException e) { return; }
>>
>> (nai, akribws, AYTHN lew)
>

  Το αιώνιο σύμπλεγμα κατωτερότητας των C/C++ προγραμματιστών έναντι αυτών της Java. Τι φόβόσαστε 
ρε παιδιά, μη σας φάμε τις δουλειές σας; Αλλά είπαμε, όποιος έχει τη μύγα μυγιάζεται.

>To ena den apokleiei to allo:
>
>try {
>	File thisIsAnInstanceOfTheClassFile = new File("file");
>	FileInputStream FileInputStreamObject =
>		new FileInputStream(thisIsAnInstanceOfTheClassFile);
>} catch (FileNotFoundException e) {
>	boolean BooleanVariableDenotingExitStatus=false;
>	return BooleanVariableDenotingExitStatus;
>}
>

  ή ακόμα πιο εύκολα...

  public int openFileForInput() throws FileNotFoundException
  {
    if ( new FileInputStream(new File("file")) == null ) return 1;

    ή

    return  ( new FileInputStream(new File("file")) == null? 0 : 1);
  }

  όχι ότι συνηγορώ με το παραπάνω, είμαι κατά της δήλωσης εξαιρέσεων στην δήλωση της μεθόδου και 
κατά του ternary operator (κυρίως για θέμα καθαρότητας), απλώς να δείξω καιέναν άλλο τρόπο.






More information about the Linux-greek-users mailing list