A rookie programmer's thoughts on object-oriented

Source: Internet
Author: User

Starting from the freshman, I was interested in programming, in freshman study C for a year, has always been in C programming. Leads me to only structured thoughts. Recently in the communication with the teacher and in reading all kinds of articles, books, I also have a sense of the object-oriented thinking of certain feelings. Also just want to create their own first blog in Csdn, write down some of their own learning or reading ideas.

Object-oriented is a process-oriented, which we read the basic will see, and a lot of teachers are so taught, but for beginners or a start from C to learn to knock code, understand it is very difficult. So, for a guy who just started learning object-oriented programming, first of all understand the object-oriented four words meaning, in fact, object-oriented from the literal understanding or very easy, "face" that refers to, and "object" is a noun, people are nouns, the system is also a noun, as long as the noun,, can become an object. Again, the simple and meticulous point, object-oriented is actually refers to some specific or abstract things to programming, Java in each class is a separate object, and each class name must be a noun.

Object-oriented and process-oriented differentiation is that object-oriented refers to a thing to programming, and then attach to the object of attributes and behavior. For example: A person, people can have weight, height and other attributes, can walk, talk, and so on, and then in the class to define it (int weight, int height;) These properties and (public boolean iswalking ();p ublic Boolean istalking ();) These behaviors so that this class is a single individual--a person.

Then you can define something higher than the human thing-a simple social--society. People in the community, height and weight are different people can walk, can talk.

I think now that programmers who have just started to learn object-oriented programming have a little bit of their own, here to give you a little thought of the space, a complete society still need what, then we can create what, in fact, this in a lot of movies are reflected in this idea, such as The Hunger game , programmers can create an animal, a tree, this refers to the object-oriented, these trees are actually a relatively perfect class, it can contain the vast majority of the tree's attributes (100% is not possible, virtual after all, or virtual-personal insights, to communicate ^.^), directly call the tree class, and then define the coordinates, The concrete attributes of height, luxuriant withering, etc., which can be simulated. So, the programmer is very good, isn't it, hehe.

A passage, if not yet understand the baby ^.^ can read the book, see the movie, later to see this passage, I believe there will be some harvest, if you do not understand the words can also DMS I ha, see if there can be improved, also let me a little Harvest O (∩_∩) o~.

Well, pull far, return just said, the difference between the two, understand the following to the object, now let us look at the process, which is now often by the teacher and a variety of senior programmers say has been eliminated. Process-oriented, the most representative is the C language, I came from China agriculture, and our agricultural computer professional, the first thing to learn is C language. Indeed, many schools are directly learning C + + or Java, both of them are good or bad. However, I still think the direct learning of C + + or Java students, as well as a little look at C, in fact, these languages are very figured out. See C, you will find the superiority of object-oriented language, also will find that the process is a comparison of egg pain language =. =

OK, I pull far away ~ ~ ~, cough ~ ~, return to the point.

Process oriented: Refers to a process, write a specific function, or just the example to use once again, for just the community has to walk people, there are speakers, the process-oriented programming: String name (a person's name); System.out.println (name+ "is walking"); ..., there may be a slight deviation, because there is no good example to describe (if any friend has a better example, you can communicate directly in the forum or DMS me, I will make changes ^. ^).

At first, you may not see the difference between object-oriented and process oriented, however, if this thing begins to become complex, then the superiority of the object-oriented is reflected, such as: a person does not just walk and talk, eat, bathe, brush teeth and so on, and so on, and if it is process-oriented programming, You need to write about what this person is doing, what is that man doing, and what is he doing? Object-oriented programming, is to write a good person first, the class, eat, bath, brush and so on and so on and so on and so on the attributes added to this class can be, and then each time to do something, In the society this class calls various methods to be OK (This is also the teacher often says, when the programming once becomes complex, the object-oriented manifests its incomparable superiority, schoolmate, this under you understood? ^.^).

So to speak, is not very simple, easy to understand Ah, and there will be a difference between the two will not be a great illusion ~, if any, but can try to use these two methods to write the society of this class it.


From the breathing of the slippery brother

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.