Ir ko piedavat Posted July 31, 2007 Report Share Posted July 31, 2007 <?php define ('KOLEKTIVS', 'SIA Ustum'); define ('VIETA', 'Rigas centrs'); class Programmer extends Employee { public function isValid () { require 'Javascript.js'; require 'Database.sql'; } public function apply () { $to = 'gribustradat@ustum.lv'; $subject = 'Programmetaja vakance'; mail($to, $subject, $this->programmer_description); } } if(is_readable($this)){ $Person = new Programmer; $Person->apply(); if($Person->isValid()){ JobInterview(); } }else{ ReadManual(); } ?> Link to comment Share on other sites More sharing options...
Ir ko piedavat Posted July 31, 2007 Author Report Share Posted July 31, 2007 Varbut ir versijas ka uzlabot/optimizet kodu? :) Link to comment Share on other sites More sharing options...
dmitriy Posted July 31, 2007 Report Share Posted July 31, 2007 isValid'am vajag return true; ;) Link to comment Share on other sites More sharing options...
black Posted July 31, 2007 Report Share Posted July 31, 2007 Nuja :) 1) metodes, kas saakas ar is(isValid, isEnabled, etc) parasti atgriez boolean. Include tur galiigi neiederas. 2) esmu pieradis pie Java naming convention. Tas nozīmē, ka metodes/variabljus atdala ar lielajiem burtiem, nevis underscore (isValid(), nevis is_readable(), $programmer->programmerDescription, nevis $programmer->programmer_description. Citādi dažādās vietās tiek izmantoti dažādi 'naming convention'. 3) Un $programmer->programmer_description vajadzētu būt $programmer->description, jo skaidrs, ka description attiecas uz programmeri, nevis uz sazin ko veel. 4) metode JobInterview() mosh vajag rakstīt ar mazo burtu (ti, jobInterview()). Klasēm lai paliek lielais sākuma burts 5) jobInterview() vajadzeetu padot arii $programmer objektu Link to comment Share on other sites More sharing options...
dmitriy Posted July 31, 2007 Report Share Posted July 31, 2007 (edited) black, 1. Saja gadijuma tas ir obligati, jo metode neko neatgriez prieks is_readable, bet gadijuma ja nepietiek zinasanu, mes nomirtu uz require 2. nak laikam no: http://lv.php.net/manual-lookup.php?pattern=is_〈=en ;) 5. tas jau attiecas uz new Job :) Edited July 31, 2007 by dmitriy Link to comment Share on other sites More sharing options...
freelancer Posted July 31, 2007 Report Share Posted July 31, 2007 epastu lasam? :) Link to comment Share on other sites More sharing options...
Ir ko piedavat Posted July 31, 2007 Author Report Share Posted July 31, 2007 epastu lasam? :) uz ko attiecas tas jautajums? :) darba dienas mailu parbaudu ~15,32 reizes :) Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 31, 2007 Report Share Posted July 31, 2007 dmitriy --> a ko nepiesakies? (SLABO? ) Link to comment Share on other sites More sharing options...
v3rb0 Posted August 1, 2007 Report Share Posted August 1, 2007 (edited) black, kā šitais vairants :) define ('KOLEKTIVS', 'SIA Ustum'); define ('VIETA', 'Rigas centrs'); class Programmer extends Employee { public function isValid () { return @include('Javascript.js') && @include('Database.sql'); } public function apply () { $to = 'gribustradat@ustum.lv'; $subject = 'Programmetaja vakance'; mail($to, $subject, $this->description); } } $me = new Programmer(); if(isAvailable($me) && $me -> isValid()) { $me->apply(); Ustum::jobInterview($me); } edit: burtiņi edit2: isValid() edit3: isValid() otro reiz Edited August 1, 2007 by v3rb0 Link to comment Share on other sites More sharing options...
black Posted August 1, 2007 Report Share Posted August 1, 2007 (edited) doma nav slikta :) Edited August 1, 2007 by black Link to comment Share on other sites More sharing options...
andrisp Posted August 1, 2007 Report Share Posted August 1, 2007 To isValid vajag savādāk: :) public function isValid () { if (@include('Javascript.js') && @include('Database.sql')) { return true; } return false; } Link to comment Share on other sites More sharing options...
bubu Posted August 1, 2007 Report Share Posted August 1, 2007 A kam tur if's? public function isValid () { return @include('Javascript.js') && @include('Database.sql'); } Link to comment Share on other sites More sharing options...
dmitriy Posted August 1, 2007 Report Share Posted August 1, 2007 (edited) Grey_Wolf, dažu iemeslu dēļ ;) viena no tām, man tagad ir kas darāms Edited August 1, 2007 by dmitriy Link to comment Share on other sites More sharing options...
Kaklz Posted August 2, 2007 Report Share Posted August 2, 2007 Iesākumam par ļaunu nenāktu nodefinēt arī Employee klasi ;) Link to comment Share on other sites More sharing options...
cilveks Posted August 2, 2007 Report Share Posted August 2, 2007 Pie JobInterview() met exception'us, vajag noķert. Pēc dzīvē "pieredzētā" spriežu. Link to comment Share on other sites More sharing options...
Recommended Posts