* hemanth has changed the topic to: PERL and RUBY OOP
<hemanth> So far we saw an overview of py OOP
* Laks (51625fc3@gateway/web/freenode/ip.81.98.95.195) has joined #p2pu-webcraft/scripting-101
<hemanth> Even though OOP is very vast
<hemanth> we can get started easily
<hemanth> by knowing the skeleton
<hemanth> so with reference to yest, i will just give you an intro to how the same works in pl and rb
<hemanth> So first up is class declaration
<hemanth> class ClassName
<hemanth> end
<hemanth> in rb ^
<hemanth> class ClassName {
<hemanth>
<hemanth> }
<hemanth> or class ClassName;
<hemanth> in pl^
<hemanth> pl6 is what i suggest for OOP
<hemanth> 2)0bject creation
<hemanth> new class_name(...) in pl
<hemanth> class_name.new(...) in rb
<hemanth> 3) Method invocation
<hemanth> object.method
<hemanth> object.method(param)
<hemanth> 4) Testing class membership
<hemanth> is_a? kind_of? in rb
<hemanth> isa in pl
<hemanth> 5) Inheritance
<hemanth> class child < parent end in rb
<hemanth> class child is parent { ... } in pl
<hemanth> seems fine and kool so far :) ?
<SourRust> yup
<Laks> yes
<hemanth> So, if one is not willing to do OOP with pl6
<hemanth> use package Color; instead of class ClassName;
<hemanth> and method invoking must be done with "->" that is like object->method
* adamcollado (4575bfc4@gateway/web/freenode/ip.69.117.191.196) has joined #p2pu-webcraft/scripting-101
<adamcollado> hellooo
<hemanth> If you all rembr, when dealing with variables in rb, i had mentioned about instance variables
<hemanth> adamcollado, Halloween :)
<adamcollado> sorry for lateness =/
<adamcollado> yes
<adamcollado> fun time in new york :)
<Laks> we are one hour behind from today
* hemanth sends logs so far to adamcollado
<hemanth> Halloween from CS grades http://i.imgur.com/AGj4n.jpg
<hemanth> :)
<hemanth> @var_name is rb is an instance variable
<adamcollado> lol
<hemanth> :)
<adamcollado> thanks hemanth for the log
* Laks has quit (Quit: Page closed)
* laks (51625fc3@gateway/web/freenode/ip.81.98.95.195) has joined #p2pu-webcraft/scripting-101
<hemanth> adamcollado, np :) trying to keep it as crisp as possible, as i learnt that this class likes crispness and all are smart enuf to get the fruit, if shown the root ;)
<adamcollado> yep :)
<hemanth> Similarly Class variables are accessed using the @@ operator
<hemanth> @_@
<adamcollado> lol
<hemanth> private :method_name in the class makes that method private
<hemanth> that is those methods can be accessed by the instances alone and is not passed to the child
<hemanth> Public is default accessibility level for class methods.
* laks has quit (Client Quit)
* laks (51625fc3@gateway/web/freenode/ip.81.98.95.195) has joined #p2pu-webcraft/scripting-101
<hemanth> again in pl, we have @ISA = qw( Parent ); for inheritance and class child is parent { ... } in pl6
<hemanth> Simple example of class in rb:
<hemanth> class String
<hemanth> def NullOrEmpty?
<hemanth> (self == nil || self == "")
<hemanth> end
<hemanth> end
<hemanth> puts "test".NullOrEmpty?
<hemanth> puts "".NullOrEmpty?
<hemanth> o/ ??
<SourRust> nope
<hemanth> in pl :
<hemanth> class Shape {
<hemanth> has $.x is rw;
<hemanth> has $.y is rw;
<hemanth> method moveTo($newx, $newy) {
<hemanth> $.x = $newx;
<hemanth> $.y = $newy;
<hemanth> }
<hemanth> }
<hemanth> pl6 ^
* laks has quit (Ping timeout: 265 seconds)
<hemanth> package MyClass;
<hemanth> sub new
<hemanth> {
<hemanth> print " MyClass::new called\n";
<hemanth> my $type = shift; # The package/type name
<hemanth> my $self = {}; # Reference to empty hash
<hemanth> return bless $self, $type;
<hemanth> }
<hemanth> sub DESTROY
<hemanth> {
<hemanth> print " MyClass::DESTROY called\n";
<hemanth> }
<hemanth> new is the constructor and DESTROY is destructor
* laks (51625fc3@gateway/web/freenode/ip.81.98.95.195) has joined #p2pu-webcraft/scripting-101
<hemanth> that is those sub's are called when the object is cerated and destroyed
<hemanth> o/ ?
<laks> No
<SourRust> is $. like a this or self
<hemanth> yes :)
* PaBLoX (ba688ccc@gateway/web/freenode/ip.186.104.140.204) has joined #p2pu-webcraft/scripting-101
<SourRust> kk
<PaBLoX> Hi!
<PaBLoX> Sorry again ¬¬
<hemanth> PaBLoX, its ok
* hemanth sends logs to PaBLoX ¬¬
<hemanth> So in sub's of pl we can use the key word 'my' and the var-name to make them behave as instance vars
<hemanth> So this just gives a glimpse of pl and rb OOP, after yestd OOP and PY OOP intro
<hemanth> So, there is no hurry, learn programming in a life time :) not in 14 days ;)
<hemanth> this class so far hopefully has given an overview of BASH,py,pl and rb
<hemanth> it's just half step of the first step of coding
<hemanth> All's fine so far..:)?
<hemanth> as been the most repeated line in this class
<SourRust> yup
<PaBLoX> Yup
<laks> yes
<PaBLoX> I'm sorry I still can catch up with the files D:
<hemanth> as a whole, i have learnt many things from all of you
<PaBLoX> *
<PaBLoX> *can't
<hemanth> learning and let learning is the Mantra
<hemanth> its not the end, but the start
<hemanth> PaBLoX, no issue, you have loads of time from now on
<hemanth> SourRust, get the on time award
<SourRust> xD
* hemanth sends chocolates to SourRust
<hemanth> i really need to appreciate the way he has maintained the time
<laks> :)
<hemanth> Adams and Jimmy have been very active on git project p2pu
<hemanth> ++ to there karma
<hemanth> all other potential candidates who will be reading this log, do have time to get more awards
<hemanth> all in all it has been a rocking experience with you guys
<hemanth> will indeed miss you all and feel empty from next week
<hemanth> but, very true we all are connected
<PaBLoX> <3!
<hemanth> code together with me in http://github.com/hemanth
<hemanth> follow me on http://twitter.com/hemanth_hm
<hemanth> or even add me on http://facebook.com/hemanth
<hemanth> last but not the least can comment on my posts http://h3manth.com
<adamcollado> sadness
<hemanth> Me feel delighted to come so far and whole heartedly thanks the Mozilla P2PU group :)
<hemanth> which we all are part of
<hemanth> we must be happy that we are a part of a great revolution
<PaBLoX> hemanth: following you on twitter
<hemanth> PaBLoX, :)
<hemanth> we are reshaping and redefining education
<hemanth> i will be sending you all a simple feedback form, for the betterment of the future courses i would be running in P2PU, so please give your valuable time in filling them :)
<adamcollado> sure thing!!
<hemanth> So, now its your turn to say few words here :)
* hemanth rembrs the first day, where each of them introduced themselves :)
* hemanth is still as excited as the first class :D
<adamcollado> It was kinda tough at first juggling 4 langauges at the same time, but I got use to it. I also learned how to use git pretty well! :D
<hemanth> adamcollado, nice :)
<hemanth> hemanth, is following PaBLoX on twitter
<PaBLoX> hemanth: cool =)
<adamcollado> hemanth, i just started following you on twitter as well :)
<PaBLoX> Well, actually I still find hard to work with 4 languages at the same time
<PaBLoX> adamcollado: which is your twitter?
<adamcollado> datruth29
<PaBLoX> I'm going to create a list :)
<hemanth> SourRust, laks you guys there?
<hemanth> PaBLoX, was thinking the same :)!
<PaBLoX> p2pu-scripting101
<PaBLoX> ?
<SourRust> yea
<hemanth> okies
* laks has quit (Ping timeout: 265 seconds)
<PaBLoX> http://twitter.com/#!/PaBLoX/p2pu-scripting101
<PaBLoX> I'm gonna add there everyone that participated here
<PaBLoX> =)
<PaBLoX> BTW, I'll wait for a scripting 200
<PaBLoX> =P
<hemanth> ha ha :D
<adamcollado> yes :D
<hemanth> So those who want to get involved in pygtk
<hemanth> can go through the blames of http://github.com/hemanth/futhark/blame/master/gtk-window.py
<hemanth> i had take a long time to make that file, so it would be easy to get started
* laks (51625fc3@gateway/web/freenode/ip.81.98.95.195) has joined #p2pu-webcraft/scripting-101
<hemanth> hemanth, sends a follow request to adamcollado :)
<adamcollado> cool :D
<PaBLoX> adamcollado: same here
<laks> It was a really good learning experience. Logging on every weekend
<hemanth> i lately made a python irc bot, see the video here http://vimeo.com/16360222
<hemanth> laks, ok :)
<adamcollado> I enjoyed the looking at each other's code aspect in the github, especially the limpid code base :)
<hemanth> adamcollado,:)
<hemanth> limpid was a dream come true for me
<hemanth> hoping to make it better with all ur helping hands
<hemanth> hack more on p2pu => http://github.com/p2pu
<hemanth> So if no more o/ i will end this class here
<hemanth> :)
<adamcollado> okay :)
<hemanth> do keep in touch
<hemanth> init0 for now :)
<adamcollado> lawl
<laks> thanks for teaching us:)
<adamcollado> yes, thanks hemanth!
<hemanth> thank you all :)
<adamcollado> Later!
* adamcollado has quit (Quit: Page closed)
<SourRust> cya guys