

Describe yourself as a programming object - nextmoveone

I was looking at craigslist posting for a job and it asked me to program myself as a php class. I thought this was cool and wanted to see if any YCer's wanted to give it a try. Here is me:<p>&#60;?php<p>class Auston {<p>function Auston(){
 //basic stats
 $age = 21;
 $experience = 2.5;
 $knowsajax = true;
 $knowssemantichtml = true;
 $knowscss = true;
 $phone = '944-870-6259';
 $email = 'auston.bsen@gal.cm';
 }<p><pre><code> function beCreative($input){
 //Does defining myself as an object constitute creativity?
 $output = $input.rand($ideas, $thoughts);
 return $output;
 }

 function learn($skill, $language){
   //I love learning new things
    if(isset($skill)){
         $relatedinfo = $query-&#62;google($skill);
         $query-&#62;storeIntoDB($relatedinfo);
        }
    elseif(isset($language)){
        $relatedinfo = $query-&#62;google($skill);
        $query-&#62;storeIntoDB($relatedinfo);
         $readbook = $buybook-&#62;fromborderson($relatedinfo);
        $query-&#62;storeIntoDB($readbook);
        }
    else{
      return false;
    }
 }
 
 function multitask($arrayofupto5tasks){
   //I can easily manage 3-5 small tasks
   $i = 0;
  foreach ($arrayofupto5tasks as $value){
  $query-&#62;storeIntoDB($value);
  $execute-&#62;task($arrayofupto5tasks[$i]);
  $i++
  }
 }
 
 
 function deliverProjectIn($time){
 $deliverytime = $time/3;
 $execute-&#62;projectIn($deliverytime);
 //that was a joke
 }
 
 function beAtWorkBy($time){
 $wakeup = $time+3600;
 $drivetowork = $wakeup+1800;
 $gettowork = $drivetowork+1800;
 //that was a joke
 }

 function showDemo(){
 $arrayofsites = array('http://www.nextmoveinc.com/ycomb/heom_demo.html ', 'http://www.investorscrystalball.com', 'http://www.expeditedtravel.com/call-center/index.html' );
 $site = rand(0,2);
 header('Location :'.$site.');
 }
</code></pre>
}<p>?&#62;
======
neilk
One morning, when Gregor Samsa woke from troubled dreams, he found himself

transformed in his bed into a PHP class. He lay between clumsy pointed

brackets, and if he lifted his head a little he could see his soft-referenced

underbelly, poorly indented and divided into giant blocks with redundant loops

and parallel data structures. The tests were hardly able to cover it and
seemed

ready to slide off any moment. His many built-ins, pitifully feeble compared

to the bloated code they had to support, thrashed about helplessly

as he looked.

~~~
darose
LOL!!!

I guess I'm the only one who got the ref.

(For all you uncultured lamers:
<http://en.wikipedia.org/wiki/The_metamorphosis>) :-)

------
jgrahamc
1\. Your constructor has its entire contents commented out.

2\. You should remove the $i in the function multitask(). You don't need it
because the foreach is storing $arrayofupto5tasks[$i] in $value.

    
    
     function multitask($arrayofupto5tasks){
       //I can easily manage 3-5 small tasks
       $i = 0;
      foreach ($arrayofupto5tasks as $value){
      $query->storeIntoDB($value);
      $execute->task($arrayofupto5tasks[$i]);
      $i++
      }
     }
    

3\. It's disappointing that your showDemo() function has a hard coded number 2
in it ($site = rand(0,2);) since you could get that from the array length. And
also the header() bit has an extra ' in it.

4\. Your learn() function returns false in one case and doesn't return
anything in others.

~~~
nextmoveone
i was hoping someone would do this...

1.the constructor isnt commented out in text mate, or dreamweaver just
here(yc).

2.i need the $i cause i store the task into the db then execute it.

3\. i could have done that, and it would scale. but i didnt cause i only have
3 demos. you are probably right about the extra '

4\. need to review it, im on my phone right now

~~~
jgrahamc
1\. I wondered if that might be the case.

2\. I don't understand this explanation, is $value destroyed by the call to
storeIntoDB? At the very least your $i++ needs a terminating ;

~~~
nextmoveone
you are right! i should have went with a while loop

------
marcus
I can't, it is considered bad form to write up a god object.

~~~
wlievens
I almost laughed out loud at this. At work :-)

------
icky
def icky(should_be_hacking=True):

    
    
            try:
                while should_be_hacking:
                    yc.news.read()
                    yc.news.post(inane=True)
            except IOError:
                grumble()
            hack()
    

