Position:Home>JAVA Development> The abstraction in detailed and analytic Java kind the distinction with interfac
The abstraction in detailed and analytic Java kind the distinction with interfac
From;  Author:Stand originally
In Java language, abstract Class and Interface are supportive abstraction kind two kinds of mechanisms of the definition. As a result of the existence of these two kinds of mechanisms, just gifted the object-oriented ability with powerful Java. Be in between Abstract Class and Interface to abstraction kind the supportive respect of the definition has very big similar sex, can replace each other even, because this a lot of developer are undertaking abstraction kind the to Abstract Class and Interface choice when the definition appears more optional. Actually, both between still have very big distinction, mirror instead even to their choice reasonable. The article will undertake one time analysing to the distinction between them, try to provide a basis that has choosing between both to developer.

Understanding is abstract kind

Abstract Class and Interface are to be used in Java language undertake abstraction kind (the abstract syncretic blame in the article is translated from Abstract Class and come, it is denotive it is an abstract body, and Abstract Class is used at defining abstraction for Java language call the turn kind a kind of method, ask a reader to notice to distinguish) of the definition, so what is abstract kind, use abstraction kind what profit can you bring for us?

In object-oriented concept, we know all boy or girl friends is to pass kind will depict, but not be however conversely such. Not all kind it is to use those who describe a boy or girl friend, if kind in did not include enough information to represent a specific target, such kind it is abstract kind. Abstract kind often use the abstract concept that we are in token to make reach in analysis, design to problem domain, it is different to a series of looking, but substantially the abstraction of same specific idea. For instance: If we undertake a graph edits the development of software, with respect to meeting discovery problem domain is existing round, triangle such a few specific concepts, they are different, but they attribute figure again a such concepts, this concept is in appearance problem domain is nonexistent, it is an abstract concept. Do not have corresponding specific concept in problem domain because of abstract concept just about, token of in order to is so abstract notional abstraction kind be cannot enough example changes.

In object-oriented domain, abstract kind basically use undertake the type is concealed. We can construct the abstract description that gives a fixed one group action, but this group of behavior can have random however possible specific implementation way. This abstract description is abstract kind, and this group of random likely specific implementation behaves the derive that is all likelihoods kind. Module can operate an abstract system. Because module relies on a fixed abstract system, accordingly it can not allow to revise; In the meantime, tell associate derive of this abstract body, also can expand the behavior function of this module. The reader of familiar OCP knows certainly, to can realize a of object-oriented design most the principle OCP(Open-Closed Principle) of core, abstract kind it is among them crucial place.
Previous12 3 4 5 Next