Jump to content

Learning OOP


Martijn Geerts
 Share

Recommended Posts

I wished to make a module that enables OAuth2, for use with twitter of google API's etc.

The big problem is I wish to build the module my self, but lack the knowledge.

So the biggest wish first, to get some real good documentation about OOP.

When I search the internet, the quality is not good enough or to difficult to start with. Next to that, I prefer some good podcasts cause I have some problems with reading. ( Dutch, English or German )

So does anyone know some good Video Tutorials or any good understandable information about OOP?

Link to comment
Share on other sites

No need to really learn OOP to make PW modules. What knowledge do you think you lack?

As with everything, start simple learn from the big ones. ;) Look at how modules in core or third party are done, look at HelloWorld.module. Basic modules mostly only require 1 file and it's more about what type it should be and how it's done in PW. Learning OOP will help you only understanding the backgrounds. Not saying it's not good, but maybe just start and see where you get stuck, then come here and ask. You might even figure it out on yourself, but count on the community to guide you.

I mentioned I always have had problems understanding OOP and read about it for years (java, actionscript, js etc), I'm still bad in wrapping my mind around it and build something from scratch (even still now), but just starting to do something always helped me a lot. And not surprisingly PW lead me to understand even more as before while doing some fairly advanced modules I did not think was possible. The wonderful thing is learning PW will help you elsewhere too. The year using PW I learned more than the previous 5 years!

  • Like 4
Link to comment
Share on other sites

oop easier than no.oop. how abowt real objet likes coffey maker.

$m=new coffeymaker(): $m->fillcoffey('frenchyroast'); $m->fillwater('750ml'); $coffey=$m->brew();

$me=new WillyC();

$me->drink($coffey);

$t=new toilet();

$me->pee($t);

and that.all there,^b^b^b oops

$t->flush();

and thatall there is now.youknow oop(ee)

  • Like 4
Link to comment
Share on other sites

@SiNNuT, tnx for the reference. I followed that one a few weeks ago. Learned from it.

@Soma, total agree with evething you said. Maybe I want to much at one. Remy Sharp for example gave me with his jqueryfordesigners a real good push for jQuery. Think this week continue with the start of an experimental module. ( just for learning )

@Willy C :-) Are you "KutMasta Kurt's" brother ?

Link to comment
Share on other sites

Since you mentioned oauth in your first post, have you seen this module?

http://modules.processwire.com/modules/social-twitter-update/

Looking over the code you can see that it is not even that hard to do nice stuff like this. Not that i am capable yet to do it myself but it does make sense when reading it. You can learn a lot this way, as Soma already mentioned.

  • Like 1
Link to comment
Share on other sites

Regarding learning OOP, WillyC actually makes a good point there about something that is kind of helpful in learning it. Thinking about interfaces in code the way you do interfaces with the objects you interact with in real life. Objects are meant to be self contained things that have defined inputs and outputs, hiding the [potentially complex] details of how it happens and just giving you predictable inputs and outputs. If you start relating objects in real life to their equivalent in code, things start to come together a little easier and it gets your mind in the right place. Stepping back from his toilet example :) and use something like a faucet instead. The inputs are knobs that set the temperature and strength of flow. And the output is water at the temp and flow you set.

$faucet = new Faucet();
$faucet->setTemp(97); 
$faucet->setFlow(10); 
echo $faucet->render();

(or something like that) :)

  • Like 3
Link to comment
Share on other sites

  • 1 year later...
 Share

×
×
  • Create New...