Possible Duplicates:
What does OOP mean What's the point of OOP?
i am a new guy to programming word and i can't understand what is oop. why we need oop ? we can write programmes withou开发者_StackOverflow中文版t OOP
OOP is useful in the same way structured programming is useful. You don't need to use functions since you can write a program using just goto
statements to jump around but that makes the code hard to maintain and think about. Similarly, OOP combines functions and variables into objects which allows you to break up your code further and with the added abstraction, you can more easily think about the code and write it in a way that's easier to maintain.
Its a programming paradigm. A way of thinking about problem solving. So yes you have other paradigms like functional, procedural and logical so you do not need OOP for programming.
Some problems lend themselves to OOP because they can be broken down into a set of Objects that interact to solve the problem.
These Links can help you :
Object-oriented programming
Object-Oriented Programming Concepts
Object Oriented Programming is most known for its encapsulation Capability. in structured Prgramming you have series of functions that will call each other. but in oop you are encapsulating properties and functions (methods) in your object and will ask each object to decide for itself.
for example in Structural programming you should make a human object to walk but in oop you will ask the human object to walk !
OOP is more than this, but this is the mail goal. Concepts of OOP are more close to real world concepts. so its nice for newbies to learn it. because their mind is not formed to use a paradigm that is not related to their real world experience. and remember just codding using classes does not mean that you are codding in OOP!
Each programming language is designed for a programming paradigm. like C# or java for OOP, Pascal for Structures, Haskel or F# for Functional. But you can code in C# using Structural programming (in this situation you are not using all capabilities of your programming language)
精彩评论