Good resource to learn “PRACTICAL” OOP? [closed]

僤鯓⒐⒋嵵緔 提交于 2020-01-01 09:40:11

问题


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.

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.

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.

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.

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?


回答1:


here are some

OOP best practice: Employee.GetCars() vs Cars.GetByEmployee()

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

Beginning C# Object-Oriented Programming http://www.apress.com/9781430235309/

Design Guidelines for Developing Class Libraries http://msdn.microsoft.com/en-us/library/ms229042.aspx

Design Pattern Tutorial http://www.dofactory.com/Patterns/Patterns.aspx/



来源:https://stackoverflow.com/questions/11501657/good-resource-to-learn-practical-oop

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!