开发者

think in OO by a procedural guy

开发者 https://www.devze.com 2023-01-27 15:14 出处:网络
I\'m on the stage of learning cakephp, which is a OO based framework, but i have not a good understanding o开发者_如何学编程f OO. I come fromC procedural field.

I'm on the stage of learning cakephp, which is a OO based framework, but i have not a good understanding o开发者_如何学编程f OO. I come from C procedural field.

I need something which can help me think in OO perspective. Can you advicxe me about what can I do/read/watch.... in order to help me think in OO.


You need to understand five concepts : classes ; inheritance ; the notion of private and public ; abstraction ; polymorphism. Those last two are the trickiest to understand.

No need for a book, for that. Just read any tutorial about OO PHP. Try to code a few mock classes, use inheritance and polymorphism. Make sure you understand those five concepts, up to the point you don't have to think when you hear the word to remember what they are.

And then, once you've understood all that, buy some books about OOP (Head First, as suggested by Boris Pavlovic, is a good choice).

Then, read about design patterns, even though you do not intend to use them : frameworks use (and often abuse !) design patterns, so you will have to understand them (at least, know more or less what they're about).


I would advice to read GoF design patterns. maybe not for the beginner, but a really helpful knowledge, it explains for what OOP can be helpful. There are a number of books about design patterns.


If you want to get the general understanding of OOP, you can refer the book "Object Oriented Thought Process".


Head First: Object Oriented Analysis and Design is a very good book which may be followed by Head First: Design Patterns from the same series.


Generally,Nouns in requirements translates to classes in your application. This is not a rule of thumb but happens in most cases.

Please give a look at this book Object-Oriented-Design-Heuristics by Arthur-Riel.

0

精彩评论

暂无评论...
验证码 换一张
取 消