良好的资源来学习和QUOT;实用" OOP? [英] Good resource to learn "PRACTICAL" OOP?
问题描述
这听起来像一个愚蠢的问题,因为如果谷歌OOPS
或OOPS在C#
你会得到吨的结果。但是,结果
我知道像抽象
, OOP
概念>继承并没有什么......但在编程我希望看到的的实际可用的例子>是一些吧。像多态性
你知道一个实际的例子是 Object.GetType
等
This might sound like a silly question, because if you Google "OOPS"
or "OOPS in C#"
you get tons of results. But.
I am aware of concepts of OOP
like abstraction
, inheritance
and what not... But what I want to see is some "practical usable example" of it in programming. Like for polymorphism
you know a practical example is Object.GetType
etc.
有些时候,如果不是很多,我觉得自己做这样的事情在点击一个按钮打开一个连接,并做一些东西,这不是 OOP
从什么面向我知道了,我应该有一个特定的实体/类,它应该有,我在点击按钮做的东西的方法,然后我要调用该方法,而不是在按一下按钮做的所有东西。
Some times if not many, I find myself doing something like at a button click open a connection and do some stuff, this is not OOP
oriented from what I know, I should have a particular entity/class, and it should have a method for the stuff I am doing at button click, and then I should call that method, instead of doing all the stuff at button click.
另一个例子是,我只是发现自己加载所有员工一个在工作,在项目的txtEmployeeName.Leave
事件,然后填写项目组合。这不是OOP面向要么,我应该有一流员工
,并在这一个方法,它加载所有该员工工作的项目,那么我应该拨打该方法 txtEmployeeName.Leave
。
Another example is that I just found myself loading all the projects that a employee works on, at the txtEmployeeName.Leave
event and then fill the combo for the projects. This is not OOP oriented either, I should have class Employee
, and a method in that which loads all the projects this employee works on, and then I should call that method at txtEmployeeName.Leave
.
当我发现某处或阅读(网上或其他)我看到这样,<$ C事$ C>汽车是一个抽象类,而车
是车
,所以它从车
inhered,这是继承
。我们都知道,但是这并不是一个实际的事情。另外一个例子,我发现,如果我们有一个方法 MakeSound
,我们把它叫做一个对象猫
,将呼噜声
,但如果我们呼吁狗
同样的方法,它将树皮
,这是多态性
。
When I find or read somewhere (online or whatever) I see things like, Vehicle
is a abstract class, and Car
is a Vehicle
, so it inhered from Vehicle
, and this is Inheritance
. We all understand that, but that's not a practical thing. Another example I found, that if we have a method MakeSound
, and we call it an object Cat
, it will Purr
, but if we call the same method on Dog
, it will Bark
, this is Polymorphism
.
其良好的理解,但它不是的实际的还是应该说相当的真正的编程例子的。 所以,我需要知道的是,有什么好的资源(网络,书籍或什么的),我可以阅读有关OOP,但不喜欢exaples我在以前的一段给了,但一些现实世界编程实例,将其实有我使我的代码更OO?
Its good for understanding, but its not "practical" or you should rather say "real programming example". So what I need to know is that are there any good resources (online, books or whatever) where I can read about OOP but not like in exaples I gave in previous paragraph, but some "real world programming example" that would actually have me make my code more OO?
推荐答案
这里有一些
OOP最佳实践:Employee.GetCars()VS Cars.GetByEmployee()
最佳实践和适当一流的设计面向对象语言(C#)
的 http://www.codeproject.com/Questions/232598/Best-实践和适当的类 - 设计 - 在对象或
Best practice and proper class design in object oriented language(C#) http://www.codeproject.com/Questions/232598/Best-practice-and-proper-class-design-in-object-or
开始C#面向对象的编程
的 http://www.apress.com/9781430235309/
Beginning C# Object-Oriented Programming http://www.apress.com/9781430235309/
设计开发类库
http://msdn.microsoft.com/指南EN-US /库/ ms229042.aspx
设计模式教程
的 http://www.dofactory.com/Patterns/Patterns.aspx/
这篇关于良好的资源来学习和QUOT;实用" OOP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!