开发者

how should I think in object or how to make the most out of objects?

开发者 https://www.devze.com 2022-12-19 16:03 出处:网络
I know the concept of OOP for couple of years and I\'m aware of using it and creating lets say not too complicated objects.

I know the concept of OOP for couple of years and I'm aware of using it and creating lets say not too complicated objects.

but I want to understand the OOP way better than the place I am stand right now and use it just like a real pro.

actually I'm an independent programmer I have to deal with several languages and platforms like php/.net/c++/QT and sometimes I feel lost between these giant stuff and I'm away from the OOP concept.

-is there any approach to overcome this problem ?

-I want to know how to think in a fully OOP way an开发者_StackOverflowd creating a business object as well as business plan as fast as possible then use it in my favorite language.

-is there any relation between knowing an language very well and then learning OOP?


After you have learned the concepts, the best way to better understand it would be to use it in practice. Use OOP concepts to help you accomplish what you need to.

You seem to be inferring that with OOP you are asking yourself "Am I doing it right?" A good place to start would be http://en.wikipedia.org/wiki/Object-oriented_programming

The best way to think OOP and creating business objects is to go with what the business says something is.

For example, let's assume your business has 2 different types of customers: Online and Local.

Perhaps you would then create a base Class Customer and create 2 other Classes OnlineCustomer and LocalCustomer which Inherit from the base Class Customer. This will allow you to add things specific to each customer Class which are not pertinent to the other. For example, you would probably want an email address for OnlineCustomer while you may want a standard mailing address for LocalCustomer (obviously nowadays everybody wants email addresses from everybody if they can get them but this was the best example I could come up with off the top of my head :) ).

As for any specific relation to learning a language or knowing it versus learning concepts, I would assume it would be easier to implement and use a new programming concept such as OOP after knowing the basics of a language.


Learn (at least) one pure object-oriented language and use it for some time. It will force you to use OO and over time you will start to think in matter of classes, objects and methods.

0

精彩评论

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

关注公众号