Concept approached vb.net (v) VB. NET Core concept
Vb. NET Chinese tutorials in the wording of some repetition too much even some long-winded, so that people read uninteresting, but, this vb.net Chinese tutorial is indeed very difficult to even be said to be a classic vb.net article. To be honest, apart from reading more tired, it is much better than I wrote. The second problem is that a lot of people talk about being miserable and saying everything starts from scratch, in fact, what you want to learn is just some simple grammatical changes, the most important thing is the idea of change, that is, the way of thinking, that is, after the initial groping, you in VB6 (I do not understand VB6, I only know some d ( Not the D you think of, no object-oriented success, now I decided to learn the skills of the same will be used hearty. Others mention the beta version of the problem, because the programming language is different from the general software, although beta, the basic syntax has been directed, Microsoft released the article on BETA2 is mainly involved in some of the internal components of the function improvement and bug correction, The key is that VB6 makes you feel comfortable while also making a lot of limitations for you, and VB.net is the breakthrough of these limitations, and in the near future there are some adverse rumors, most of which appeared before the vb.net release. Many people even assert that there is no VB in the vs.net. And now the opposite is true. The authors of an English-language article that first claimed that Vs.net drew on Java, in a recent essay, claimed to have corrected the previous claim that they were merely superficial, and that the internal approach to implementation was entirely different, because I did not understand these, and I did not talk about the digression. So be sure to right from wrong the rumors, and if you don't want to fall behind, you have to learn something new, and you don't have to go too far to focus on too big a topic, For example, in the future, Vs.net's Common language library will run on all platforms, at least I'm concerned about the ability to make good Windows programs, and if you have to be concerned about the extent of these events, all the instructions here are just nonsense for your level. Here are some comments I have read vb.net Chinese tutorials, and answer some questions about my article
One. Objects (object) Basic concepts
Let's look at the following paragraph:
The object of software is the abstract representation of nature objects.
The original "Object-oriented" (object-oriented) concept, in software development, even when writing programs, objects (object) become the protagonist of the brain. When you see the program, the mind is filled with the shadow and concept of the object, the function and material become part of the object, is a supporting role rather than the protagonist. The core of the program design is to describe the object, organize the object, arrange the communication between the object (transmit the message) way. Just as "man" is the main object of society, society is organized, people will communicate and coordinate with each other. ”
The object of this concept is based on the society, the organization of the program is abstract from the organization of the Society, from writing software to organizing software is the form of progress
The object concept in the software is consistent with the object concept in the real society, so the OOP concept shortens the distance between the software and the real world. This is one of the important features of OOP technology. ”
What is OOP, a software engineering including the operating system is a miniature social group. For example, say hello to our fellow-travellers, just greet them, you should be concerned about the degree of closeness, how to greet, without having to care about how your brain accepts this information, even how to send this information, and how to deal with this information.
A namespce is such a group (family, I take the abstract meaning, that is, netizens say "a group of thing with common features (family)." Of course, you have every reason to call him. Namespace, namespace, namespaces, name space. Then to the relationship between clan and clan, group to group.
So
The text reads, "For example: the core concept of function or program-oriented-function, in the eyes of the general people, is not a familiar concept, only in mathematics to learn the concept." So people are unfamiliar with the software. In the object-oriented concept, the object of the actual society, such as: people, automobiles, stocks, disk drives, bills, rooms, students, classrooms, etc. are the objects in the mind of the software designer, but also the object in the program. So, whether it's a boss or a program designer looking at a program, they are full of objects in their minds, and these individuals are real living things in people's lives, tangible objects or familiar concepts, so that software users and designers have a consistent spirit, common feeling, which makes users more satisfied with the software, Designers know more about the needs of users. ”
That is, your object as a person wants to go from one position to another, such as "s=i.tostring", I from I to S,i is in integer, and S is in string. So I passed, from integer to string. Without having to care about his past. which function to use.
Look at the category again
As described above is the common method of finding objects, and after looking for objects, it is necessary to categorize objects and understand the relationships between categories in order to organize them. For example, in the company's personnel structure, you can find that people are divided into different kinds of objects, such as salesmen, drivers, managers, etc. Cars can be divided into sports cars, buses, travel vehicles and other different kinds of objects. How to classify (classification) is an important concept of OOP "
Some netizens make fun of me, said namespace called Clan, then this class called Class, I do not know this joke for us is some inspiration, the same category, a class and B class head are students of the group, that is to say, can not form a class, and students graduated, a class will be replaced by C class, B class will be replaced by D class, so he is a life, and the human is a class, the student is a class, the teacher is a class, this is life-free. such as form is a class, Form class is always in, and formx after unload end, FORMX also have no
For example, a person from birth to the old, not more than 200 years, and "human" because the object of endless Changlong. At school,king teachers will change jobs and leave school, but the "teacher" category will always exist. For this, the individual and the group they belong to--categories--are the core concepts of OOP.
After reading some of these quotes, you may think that the Chinese language is better for these near-artistic explanations.
Two. Object Whole-part Relationship
The following "category inheritance (class inheritance) and object combination (objects composition) are two magic weapons for software reuse (reuse). Class inheritance is the relationship between the parent and the subclass, for example,,"students" can be divided into "college students", "middle school students" and "primary school students" three categories.
Category inheritance (class inheritance) probably everybody knows, as for the object Group (objects composition) You understand him as a family of your own writing, it's easy to understand that a class becomes a family by creating subclasses, although there is no explicit definition, but it helps to understand, such as System.Drawing you can understand as a class, or a class library can also, also because contains subclasses, you can also treat System.Drawing as a family name (namespace), this subclass and through the inheritance relationship
It is not difficult to understand the different meaning of the subclass, the image is as follows:
Class Class1 ' Whole
Class class1-1 ' Part1
.......
End Class
Class Class1-2 ' Part2
......
End Class
......
End Class
The purpose of the object combination is to create "compound objects" (composite object); For example, hospitals contain physicians and nurses, etc. "
The following "inheritance and combination of two magic weapons can be used jointly to organize a large software system"
1. The text reads as follows "combination/partial relationship, often called APO (A part of) relationship"
Class House houses is a whole
Class Door Door Door is a part
。。。。。。
End Class
The Class window window is a partial
。。。。。。
End Class
。。。。。。。
End Class
The original "House object was born immediately after the birth of the door object and Window object"
The so-called birth object is to declare an instance, such as Dim xxx As New Hourse (house)
"The life of a combination object with a part of the object should be consistent", as follows.
2. The driver is not a part of a car, nor is it a component of a bus, so there is no "combination/part" relationship between the car and the driver, however, the car does contain a driver, which is known as the "inclusive/content" (container-contents) relationship. ”
This is a parallel relationship, such as:
Class I (Driver)
Dim x As String
.......
End Class
Class H (CAR)
Dim myi As New I
Myi.x .....
......
End Class
Now I have no money, want to work in the company of H (Dim myi As New I), I data x (Dim x As String) had to give myi.x for H service, so which day the environment changed, also can turn, h for I work. So it's an object.
Therefore, the original text reads as follows: "The driver and the car are independent objects, unlike the engine always included in the car, the driver is included in the car when driving the car." Obviously, the life expectancy of the driver and the car is not as long. ”
3. The text reads as follows: "A set means a group of" groups "consisting of members (member). For example, there are league members in the school's clubs, and the sales department of the company contains marketing staff. The group is not like a car that actually contains drivers, but a collection of members. In this case, collectively referred to as the "set/Member" (collection-members) relationship
This means that the containing person/content is a container, and that the collection is not a container in "Set/member"
The original text reads, "There is no need to explicitly divide the" inclusive/content "and" set/member "relationship.
So, what is the difference between the member and the content, exactly, the content is an object, and the member is the collection of objects, and the collection of the object is contained in the whole, and think that this member can be foreign, and can be the original. It is as if the members of the company can be invited outside, and can be recruit. This means something like a list box, list box can be the list items are already available, and can be continuously added. "Solo/Content" (container-contents) is an organized one. The containing person is more like a container, and the collection becomes the object. This becomes the "containing person/set/member", and if the content is a variable, the collection is an array.
Class person (Member object-individual)
。。。。。。
End Class
Class Club (Collection Object-Club)
。。。。。。
Private pa as ArrayList = New ArrayList () (set up a set of ArrayList class, the method of this class has add; remove, etc.)
Public Sub join (ByVal p as person) (ByVal p as person acts like a dim p as person, introducing a "content")
Pa. Add (p) (adding "content" to a "collection")
End Sub
End Class
Three About encapsulation
The so-called encapsulation is to set the legal access rules between classes and classes
The Public keyword specifies that it is common between classes and classes
The Protected keyword specifies that the same class (family) is public, including his subclasses
The text reads as follows: "The designation of certain information is a family common, that is, only the procedure within the descendants category is desirable, and the procedure for non-descendant classes must be called into the family's procedures for access." ”
Attentive readers may have noticed that "family" has been used here, confirming the definition of family.
Private keyword specified is proprietary, not external access, and can not be shared within the family, only in his own space activities.
If you want to access a private object, only use Set;get to write an interface, or use a subroutine or function within the object to execute, and of course you add public to the Sub or function.
Four Parent-child object Relationship (inheritance relationship), parent-child object Relationship (Whole-part relationship)
I suddenly do not want to write, we can not be angry, if you want to learn more, or to see other people's tutorials, I choose some easy to see, but do not learn me, so it is inevitable out of context (is not good). In addition, if you see the error, please testify, this is to discuss anyway. If you want to scold, it is best to my forum to vent a bit (people less), at least give a brother some face. It's better to be angry. So that the level is very good and do not like to write articles of the gas to write vb.net, English is very good and do not like translation of the gas to translate vb.net, we this a large group of "Wen Busy" is blessed (no need to see me these inferior articles).
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.