由程序人员进行面向对象的思考
我正处于学习cakephp的阶段,这是一个基于OO的框架,但我对OO还没有很好的理解。我来自C程序领域。
我需要一些可以帮助我从面向对象的角度思考的东西。你能告诉我我可以做什么/阅读/观看......以帮助我以面向对象的方式思考吗?
I'm on the stage of learning cakephp, which is a OO based framework, but i have not a good understanding of 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
你需要理解五个概念:类;继承;私人和公共的概念;抽象;多态性。最后两个是最难理解的。
为此,不需要一本书。只需阅读有关 OO PHP 的任何教程即可。尝试编写一些模拟类,使用继承和多态性。确保您理解这五个概念,直到您听到这个词时不必思考就能记住它们是什么。
然后,一旦您理解了所有这些,就可以购买一些有关 OOP 的书籍(Boris Pavlovic 所建议的《Head First》是一个不错的选择)。
然后,阅读有关设计模式的信息,即使您不打算使用它们:框架使用(并且经常滥用!)设计模式,因此您必须了解它们(至少,或多或少了解它们的含义)。
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).
我建议阅读 GoF 设计模式。也许不适合初学者,但这是一个非常有用的知识,它解释了 OOP 的用处。有很多关于设计模式的书籍。
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.
如果你想对OOP有一个大概的了解,可以参考《面向对象的思维过程》一书。
If you want to get the general understanding of OOP, you can refer the book "Object Oriented Thought Process".
Head First:面向对象的分析与设计是一本非常好的书,可能是其次是同一系列的简单介绍:设计模式。
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.
一般来说,需求中的名词会转化为应用程序中的类。
这不是经验法则,但在大多数情况下都会发生。
请看一下这本书 Arthur-Riel 的面向对象设计启发式。
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.