Solution Assign a responsibility to the information expertóthe class t translation - Solution Assign a responsibility to the information expertóthe class t Indonesian how to say

Solution Assign a responsibility to

Solution Assign a responsibility to the information expertóthe class that has the information necessary to fulfill the responsibility.
Problem What is a general principle of assigning responsibilities to objects?
A Design Model may define hundreds or thousands of software classes, and an
application may require hundreds or thousands of responsibilities to be fulfilled.
During object design, when the interactions between objects are defined, we
make choices about the assignment of responsibilities to software classes. Done
well, systems tend to be easier to understand, maintain, and extend, and there is
more opportunity to reuse components in future applications.
Example In the NextGEN POS application, some class needs to know the grand total of a
sale.

By this advice, the statement is:
Who should be responsible for knowing the grand total of a sale"?
By Information Expert, we should look for that class of objects that has the
information needed to determine the total.
Now we come to a key question: Do we look in the Domain Model or the Design
Model to analyze the classes that have the information needed? The Domain
Model illustrates conceptual classes of the real-world domain; the Design Model
illustrates software classes.

Answer:
1. If there are relevant classes in the Design Model, look there first.
2. Else, look in the Domain Model, and attempt to use (or expand) its represen
tations to inspire the creation ofcorresponding design classes.
For example, assume we are just starting design work and there is no or a minimal
Design Model. Therefore, we look to the Domain Model for information experts;
perhaps the real-world Sale is one. Then, we add a software class to the Design
Model similarly called Sale, and give it the responsibility of knowing its total,
expressed with the method named getTotal. This approach supports low
representational gap in which the software design of objects appeals to our concepts of how the real domain is organized.
To examine this case in detail, consider the partial Domain Model in Figure
16.3

What information is needed to determine the grand total? It is necessary to
know about all the SalesLineltem instances of a sale and the sum of their subtotals.
A Sale instance contains these; therefore, by the guideline of Information Expert,
Sale is a suitable class of object for this responsibility; it is an information expert
for the work.
As mentioned, it is in the context of the creation of interaction diagrams that
these questions of responsibility often arise. Imagine we are starting to work
through the drawing of diagrams in order to assign responsibilities to objects. A
partial interaction diagram and class diagram in Figure 16.4 illustrate some
decisions.

We are not done yet. What information is needed to determine the line item subtotal? SalesLineltem.quantity and ProductSpecification.price are needed. The
SalesLineltem knows its quantity and its associated ProductSpecification;
therefore, by Expert, SalesLineltem should determine the subtotal; it is the
information expert.
In terms of an interaction diagram, this means that the Sale needs to send
get-Subtotal messages to each of the SalesLineltems and sum the results; this
design is shown in Figure 16.5.

To fulfill the responsibility of knowing and answering its subtotal, a SalesLineltem needs to know the product price.
The ProductSpecification is an information expert on answering its price; therefore, a message must be sent to it asking for its price.
The design is shown in Figure 16.6.
In conclusion, to fulfill the responsibility of knowing and answering the sale's
total, three responsibilities were assigned to three design classes of objects as
follows.


The context in which these responsibilities were considered and decided upon
was while drawing an interaction diagram. The method section of a class diagram
can then summarize the methods.
The principle by which each responsibility was assigned was Information
Expert-placing it with the object that had the information needed to fulfill it.

Discussion Information Expert is frequently used in the assignment of responsibilities; it is a
basic guiding principle used continuously inobject design. Expert is not meant to
be an obscure or fancy idea; it expresses the common "intuition" that objects do
things related to the information they have.
Notice that the fulfillment of a responsibility often requires information that is
spread across different classes of objects. This implies that there are many "partial"
information experts who will collaborate in the task. For example, the sales total
problem ultimately required the collaboration of three classes of objects.

via messages to share the work.
Expert usually leads to designs where a software object does those operations
that are normally done to the inanimate real-world thing it represents; Peter
Goad calls this the "Do It Myself" strategy [Coad95]. For example, in the real
world, without the use of electro-mechanical aids, a sale does not tell you its
total; it is an inanimate thing. Someone calculates the total of the sale. But in
object-oriented software land, all software objects are "alive" or "animated," and
they can take on responsibilities and do things. Fundamentally, they do things
related to the information they know. I call this the "animation" principle in
object design; it is like being in a cartoon where everything is alive.
The Information Expert patternólike many things in object technologyóhas a
real-world analogy. We commonly give responsibility to individuals who have
the information necessary to fulfill a task. For example, in a business, who
should be responsible for creating a profit-and-loss statement? The person who
has access to all the information necessary to create itóperhaps the chief financial officer. And just as software objects collaborate because the information is
spread around, so it is with people. The company's chief financial officer may
ask accountants to generate reports on credits and debits.
Contraindications There are situations where a solution suggested by Expert is undesirable, usually
because of problems in coupling and cohesion (these principles are discussed
later in this chapter).
For example, who should be responsible for saving a Sale in a database? Certainly,
much of the information to be saved is in the Sale object, and thus by Expert an
argument could be made to put the responsibility in the Sale class. And the
logical extension of this decision is that each class has its own services to save
itself in a database. But this leads to problems in cohesion, coupling, and
duplication. For example, the Sale class must now contain logic related to database handling, such as related to SQL and JDBC (Java Database Connectivity).
The class is no longer focused on just the pure application logic of "being a sale;" it
now has other kinds of responsibilities, which lowers its cohesion. The class must
be coupled to the technical database services of another subsystem, such as
JDBC services, rather than just being coupled to other objects in the domain layer
of software objects, which raises its coupling. And it is likely that similar database
logic would be duplicated in many persistent classes.
All these problems indicate violation of a basic architectural principle: design
for a separation of major system concerns. Keep application logic in one place
(such as the domain software objects), keep database logic in another place
(such as a separate persistence services subsystem), and so forth, rather than
intermingling different system concerns in the same component.


Supporting a separation of major concerns improves coupling and cohesion in a
design. Thus, even though by Expert there could be some justification to put the
responsibility for database services in the Sale class, for other reasons (usually
cohesion and coupling), it is a poor design.
ï Information encapsulation is maintained, since objects use their own infor
mation to fulfill tasks. This usually supports low coupling, which leads to
more robust and maintainable systems. (Low Coupling is also a GRASP pat
tern that is discussed in a following section).
ï Behavior is distributed across the classes that have the required informa
tion, thus encouraging more cohesive "lightweight" class definitions that are
easier to understand and maintain. High cohesion is usually supported
(another pattern discussed later).
ï Low Coupling
ï High Cohesion
Also Known As; "Place responsibilities with data," "That which knows, does," "Do It Myself," "Put
Similar To Services with the Attributes They Work On.
0/5000
From: -
To: -
Results (Indonesian) 1: [Copy]
Copied!
Solusi menetapkan tanggung jawab untuk informasi kelas expertóthe yang mempunyai informasi yang diperlukan untuk memenuhi tanggung jawab.Masalah apa merupakan prinsip umum menetapkan tanggung jawab untuk objek?Model desain dapat menentukan ratusan atau ribuan kelas perangkat lunak, dan aplikasi mungkin memerlukan ratusan atau ribuan tanggung-jawab digenapi. Selama obyek Desain, ketika interaksi antara objek-objek didefinisikan, kami membuat pilihan tentang penunjukan tanggung jawab untuk perangkat lunak kelas. Dilakukan Yah, sistem cenderung lebih mudah untuk memahami, mempertahankan, dan memperluas, dan ada lebih banyak kesempatan untuk menggunakan kembali komponen dalam aplikasi masa depan.Aplikasi contoh di POS NextGEN, beberapa kelas perlu tahu grand totalpenjualan.Dengan saran ini, pernyataan ini:Siapa yang harus bertanggung jawab untuk mengetahui jumlah total penjualan"?Oleh ahli informasi, kita harus mencari kelas obyek yang informasi yang diperlukan untuk menentukan total.Sekarang kami datang untuk pertanyaan kunci: Apakah kita melihat dalam Domain Model atau desain Model untuk menganalisis kelas yang memiliki informasi yang dibutuhkan? Domain Model menggambarkan konseptual kelas dunia nyata domain; Model desain menggambarkan perangkat lunak kelas.Jawaban:1. jika tidak ada kelas yang relevan dalam Model Desain, lihat pertama. 2. lain, terlihat dalam Domain Model, dan mencoba untuk menggunakan (atau memperluas) perwakilan yang tations untuk mengilhami penciptaan ofcorresponding desain kelas. For example, assume we are just starting design work and there is no or a minimal Design Model. Therefore, we look to the Domain Model for information experts; perhaps the real-world Sale is one. Then, we add a software class to the Design Model similarly called Sale, and give it the responsibility of knowing its total, expressed with the method named getTotal. This approach supports low representational gap in which the software design of objects appeals to our concepts of how the real domain is organized.To examine this case in detail, consider the partial Domain Model in Figure 16.3What information is needed to determine the grand total? It is necessary to know about all the SalesLineltem instances of a sale and the sum of their subtotals. A Sale instance contains these; therefore, by the guideline of Information Expert, Sale is a suitable class of object for this responsibility; it is an information expert for the work.As mentioned, it is in the context of the creation of interaction diagrams that these questions of responsibility often arise. Imagine we are starting to work through the drawing of diagrams in order to assign responsibilities to objects. A partial interaction diagram and class diagram in Figure 16.4 illustrate some decisions.We are not done yet. What information is needed to determine the line item subtotal? SalesLineltem.quantity and ProductSpecification.price are needed. The SalesLineltem knows its quantity and its associated ProductSpecification; therefore, by Expert, SalesLineltem should determine the subtotal; it is the information expert.In terms of an interaction diagram, this means that the Sale needs to send get-Subtotal messages to each of the SalesLineltems and sum the results; this design is shown in Figure 16.5.To fulfill the responsibility of knowing and answering its subtotal, a SalesLineltem needs to know the product price.The ProductSpecification is an information expert on answering its price; therefore, a message must be sent to it asking for its price.The design is shown in Figure 16.6.In conclusion, to fulfill the responsibility of knowing and answering the sale's total, three responsibilities were assigned to three design classes of objects as follows.The context in which these responsibilities were considered and decided upon was while drawing an interaction diagram. The method section of a class diagram can then summarize the methods.The principle by which each responsibility was assigned was Information Expert-placing it with the object that had the information needed to fulfill it.Discussion Information Expert is frequently used in the assignment of responsibilities; it is a basic guiding principle used continuously inobject design. Expert is not meant to be an obscure or fancy idea; it expresses the common "intuition" that objects do things related to the information they have.Notice that the fulfillment of a responsibility often requires information that is spread across different classes of objects. This implies that there are many "partial" information experts who will collaborate in the task. For example, the sales total problem ultimately required the collaboration of three classes of objects.via messages to share the work.Expert usually leads to designs where a software object does those operations that are normally done to the inanimate real-world thing it represents; Peter Goad calls this the "Do It Myself" strategy [Coad95]. For example, in the real world, without the use of electro-mechanical aids, a sale does not tell you its total; it is an inanimate thing. Someone calculates the total of the sale. But in object-oriented software land, all software objects are "alive" or "animated," and they can take on responsibilities and do things. Fundamentally, they do things related to the information they know. I call this the "animation" principle in object design; it is like being in a cartoon where everything is alive.The Information Expert patternólike many things in object technologyóhas a real-world analogy. We commonly give responsibility to individuals who have the information necessary to fulfill a task. For example, in a business, who should be responsible for creating a profit-and-loss statement? The person who has access to all the information necessary to create itóperhaps the chief financial officer. And just as software objects collaborate because the information is spread around, so it is with people. The company's chief financial officer may ask accountants to generate reports on credits and debits.Contraindications There are situations where a solution suggested by Expert is undesirable, usually because of problems in coupling and cohesion (these principles are discussed later in this chapter).For example, who should be responsible for saving a Sale in a database? Certainly, much of the information to be saved is in the Sale object, and thus by Expert an argument could be made to put the responsibility in the Sale class. And the logical extension of this decision is that each class has its own services to save itself in a database. But this leads to problems in cohesion, coupling, and duplication. For example, the Sale class must now contain logic related to database handling, such as related to SQL and JDBC (Java Database Connectivity). The class is no longer focused on just the pure application logic of "being a sale;" it now has other kinds of responsibilities, which lowers its cohesion. The class must be coupled to the technical database services of another subsystem, such as JDBC services, rather than just being coupled to other objects in the domain layer of software objects, which raises its coupling. And it is likely that similar database logic would be duplicated in many persistent classes.All these problems indicate violation of a basic architectural principle: design for a separation of major system concerns. Keep application logic in one place (such as the domain software objects), keep database logic in another place (such as a separate persistence services subsystem), and so forth, rather than intermingling different system concerns in the same component.Supporting a separation of major concerns improves coupling and cohesion in a design. Thus, even though by Expert there could be some justification to put the responsibility for database services in the Sale class, for other reasons (usually cohesion and coupling), it is a poor design.ï Information encapsulation is maintained, since objects use their own infor mation to fulfill tasks. This usually supports low coupling, which leads to more robust and maintainable systems. (Low Coupling is also a GRASP pat tern that is discussed in a following section). ï Behavior is distributed across the classes that have the required informa tion, thus encouraging more cohesive "lightweight" class definitions that are easier to understand and maintain. High cohesion is usually supported (another pattern discussed later). ï Low Coupling ï High Cohesion Also Known As; "Place responsibilities with data," "That which knows, does," "Do It Myself," "Put Similar To Services with the Attributes They Work On.
Being translated, please wait..
 
Other languages
The translation tool support: Afrikaans, Albanian, Amharic, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chichewa, Chinese, Chinese Traditional, Corsican, Croatian, Czech, Danish, Detect language, Dutch, English, Esperanto, Estonian, Filipino, Finnish, French, Frisian, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hausa, Hawaiian, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Korean, Kurdish (Kurmanji), Kyrgyz, Lao, Latin, Latvian, Lithuanian, Luxembourgish, Macedonian, Malagasy, Malay, Malayalam, Maltese, Maori, Marathi, Mongolian, Myanmar (Burmese), Nepali, Norwegian, Odia (Oriya), Pashto, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Samoan, Scots Gaelic, Serbian, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenian, Somali, Spanish, Sundanese, Swahili, Swedish, Tajik, Tamil, Tatar, Telugu, Thai, Turkish, Turkmen, Ukrainian, Urdu, Uyghur, Uzbek, Vietnamese, Welsh, Xhosa, Yiddish, Yoruba, Zulu, Language translation.

Copyright ©2024 I Love Translation. All reserved.

E-mail: