Solution Assign class B the responsibility to create an instance of cl translation - Solution Assign class B the responsibility to create an instance of cl Indonesian how to say

Solution Assign class B the respons

Solution Assign class B the responsibility to create an instance of class A if one or more of
the following is true:
ï B aggregates A objects.
ï B contains A objects.
ï B records instances of A objects.
ï B closely uses A objects.
ï B has the initializing data that will be passed to A when it is created (thus B
is an Expert with respect to creating A).
B is a creator of A objects.
If more than one option applies, prefer a class B which aggregates or contains
class A.
Problem Who should be responsible for creating a new instance of some class?
The creation of objects is one of the most common activities in an object-oriented
system. Consequently, it is useful to have a general principle for the assignment
of creation responsibilities. Assigned well, the design can support low coupling,
increased clarity, encapsulation, and reusability

Example In the POS application, who should be responsible for creating a SalesLineltem
instance? By Creator, we should look for a class that aggregates, contains, and so
on, SalesLineltem instances. Consider the partial domain model in Figure 16.7

Since a Sate contains (in fact, aggregates) many SalesLineltem objects, the Creator pattern suggests that Sale is a good candidate to have the responsibility of
creating SalesLineltem instances.
This leads to a design of object interactions as shown in Figure 16.8

This assignment of responsibilities requires that a makeLineltem method be
defined in Sate.
Once again, 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 responsibility assignment results, concretely realized as methods.
Discussion Creator guides assigning responsibilities related to the creation of objects, a
very common task. The basic intent of the Creator pattern is to find a creator
that needs to be connected to the created object in any event. Choosing it as the
creator supports low coupling.
Aggregate aggregates Part, Container contains Content, and Recorder records
Recorded are all very common relationships between classes in a class diagram.
Creator suggests that the enclosing container or recorder class is a good candidate for the responsibility of creating the thing contained or recorded. Of course,
this is only a guideline.
Note that the concept of aggregation has been used in considering the Creator
pattern. Aggregation is discussed in Chapter 27; a brief definition is that aggregation involves things that are in a strong Whole-Part or Assembly-Part relationship, such as Body aggregates Leg or Paragraph aggregates Sentence.
Sometimes a creator is found by looking for the class that has the initializing
data that will be passed in during creation. This is actually an example of the
Expert pattern. Initializing data is passed in during creation via some kind of
initialization method, such as a Java constructor that has parameters. For
example, assume that a Payment instance needs to be initialized, when created,
with the Sale total. Since Sale knows the total, Sale is a candidate creator of the
Payment.
Contraindications Often, creation requires significant complexity, such as using recycled instances
for performance reasons, conditionally creating an instance from one of a family
of similar classes based upon some external property value, and so forth. In
these cases, it is advisable to delegate creation to a helper class called a Factory
[GHJV95] rather than use the class suggested by Creator. Factories are discussed in Chapter 23.
Benefits
Related Patterns
or Principles
Low coupling (described next) is supported, which implies lower maintenance dependencies and higher opportunities for reuse. Coupling is probably
not increased because the created class is likely already visible to the creator
class, due to the existing associations that motivated its choice as creator.
Low Coupling
Factory
Whole-Part [BMRSS96] describes a pattern to define aggregate objects that
support encapsulation of components.

0/5000
From: -
To: -
Results (Indonesian) 1: [Copy]
Copied!
Solution Assign class B the responsibility to create an instance of class A if one or more of the following is true:ï B aggregates A objects. ï B contains A objects. ï B records instances of A objects. ï B closely uses A objects. ï B has the initializing data that will be passed to A when it is created (thus B is an Expert with respect to creating A). B is a creator of A objects.If more than one option applies, prefer a class B which aggregates or contains class A.Problem Who should be responsible for creating a new instance of some class?The creation of objects is one of the most common activities in an object-oriented system. Consequently, it is useful to have a general principle for the assignment of creation responsibilities. Assigned well, the design can support low coupling, increased clarity, encapsulation, and reusabilityExample In the POS application, who should be responsible for creating a SalesLineltem instance? By Creator, we should look for a class that aggregates, contains, and so on, SalesLineltem instances. Consider the partial domain model in Figure 16.7Since a Sate contains (in fact, aggregates) many SalesLineltem objects, the Creator pattern suggests that Sale is a good candidate to have the responsibility of creating SalesLineltem instances.This leads to a design of object interactions as shown in Figure 16.8This assignment of responsibilities requires that a makeLineltem method be defined in Sate.Once again, 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 responsibility assignment results, concretely realized as methods.Discussion Creator guides assigning responsibilities related to the creation of objects, a very common task. The basic intent of the Creator pattern is to find a creator that needs to be connected to the created object in any event. Choosing it as the creator supports low coupling.Aggregate aggregates Part, Container contains Content, and Recorder records Recorded are all very common relationships between classes in a class diagram. Creator suggests that the enclosing container or recorder class is a good candidate for the responsibility of creating the thing contained or recorded. Of course, this is only a guideline.Note that the concept of aggregation has been used in considering the Creator pattern. Aggregation is discussed in Chapter 27; a brief definition is that aggregation involves things that are in a strong Whole-Part or Assembly-Part relationship, such as Body aggregates Leg or Paragraph aggregates Sentence.Sometimes a creator is found by looking for the class that has the initializing data that will be passed in during creation. This is actually an example of the Expert pattern. Initializing data is passed in during creation via some kind of initialization method, such as a Java constructor that has parameters. For example, assume that a Payment instance needs to be initialized, when created, with the Sale total. Since Sale knows the total, Sale is a candidate creator of the Payment.Contraindications Often, creation requires significant complexity, such as using recycled instances for performance reasons, conditionally creating an instance from one of a family of similar classes based upon some external property value, and so forth. In these cases, it is advisable to delegate creation to a helper class called a Factory [GHJV95] rather than use the class suggested by Creator. Factories are discussed in Chapter 23.BenefitsRelated Patterns or PrinciplesLow coupling (described next) is supported, which implies lower maintenance dependencies and higher opportunities for reuse. Coupling is probably not increased because the created class is likely already visible to the creator class, due to the existing associations that motivated its choice as creator.Low Coupling FactoryWhole-Part [BMRSS96] describes a pattern to define aggregate objects that support encapsulation of components.
Being translated, please wait..
Results (Indonesian) 2:[Copy]
Copied!
Solusi Tetapkan kelas B tanggung jawab untuk membuat sebuah instance dari kelas A jika satu atau lebih dari
yang berikut ini benar:
ï B agregat A objek.
Ï B berisi A objek.
Catatan ï B contoh A objek.
Ï B erat menggunakan A objek.
ï B memiliki data inisialisasi yang akan dilewatkan ke A ketika dibuat (sehingga B
adalah Ahli sehubungan dengan menciptakan A).
B adalah pencipta A objek.
Jika lebih dari satu pilihan berlaku, lebih memilih kelas B yang agregat atau berisi
kelas A.
Soal Siapa yang harus bertanggung jawab untuk membuat contoh baru dari beberapa kelas?
Penciptaan objek adalah salah satu kegiatan yang paling umum dalam berorientasi objek
sistem. Akibatnya, hal ini berguna untuk memiliki prinsip umum untuk tugas
tanggung jawab penciptaan. Ditugaskan baik, desain dapat mendukung kopling rendah,
peningkatan kejelasan, enkapsulasi, dan usabilitas Contoh Dalam aplikasi POS, siapa yang harus bertanggung jawab untuk menciptakan SalesLineltem misalnya? Oleh Pencipta, kita harus mencari kelas yang mengumpulkan, berisi, dan sebagainya pada, contoh SalesLineltem. Mempertimbangkan model domain parsial pada Gambar 16.7 Karena Sate mengandung (pada kenyataannya, agregat) banyak objek SalesLineltem, pola Pencipta menunjukkan bahwa Sale merupakan kandidat yang baik untuk memiliki tanggung jawab menciptakan contoh SalesLineltem. Hal ini menyebabkan desain interaksi objek sebagai ditunjukkan pada Gambar 16.8 ini tugas tanggung jawab mensyaratkan bahwa metode makeLineltem akan didefinisikan dalam Sate. Sekali lagi, konteks di mana tanggung jawab ini dianggap dan diputuskan adalah saat menggambar diagram interaksi. Bagian metode diagram kelas kemudian dapat merangkum hasil penugasan tanggung jawab, konkret diwujudkan sebagai metode. Diskusi Creator panduan memberikan tanggung jawab yang berkaitan dengan penciptaan benda-benda, sebuah tugas yang sangat umum. Maksud dasar pola Pencipta adalah untuk menemukan pencipta yang perlu terhubung ke objek yang dibuat dalam hal apapun. Memilih itu sebagai pencipta mendukung kopling rendah. Agregat agregat Bagian, Container mengandung Konten, dan catatan Perekam Direkam semua hubungan yang sangat umum antara kelas dalam diagram kelas. Pencipta menunjukkan bahwa wadah melampirkan atau kelas recorder adalah calon yang baik untuk tanggung jawab menciptakan hal yang terkandung atau direkam. Tentu saja, ini hanya pedoman. Perhatikan bahwa konsep agregasi telah digunakan dalam mempertimbangkan Pencipta pola. Agregasi dibahas dalam Bab 27; definisi singkat adalah agregasi yang melibatkan hal-hal yang di Whole-Part atau Majelis-Bagian hubungan yang kuat, seperti Body agregat Leg atau Ayat agregat Kalimat. Kadang-kadang pencipta ditemukan dengan mencari kelas yang memiliki inisialisasi data yang akan disahkan pada saat penciptaan. Ini sebenarnya sebuah contoh dari pola Ahli. Inisialisasi data yang dilewatkan di selama pembuatan melalui beberapa jenis metode inisialisasi, seperti konstruktor Java yang memiliki parameter. Untuk contoh, asumsikan bahwa contoh Pembayaran perlu diinisialisasi, ketika dibuat, dengan total penjualan. Sejak Sale tahu total, Sale adalah pencipta calon Pembayaran. Kontraindikasi Seringkali, penciptaan memerlukan kompleksitas signifikan, seperti menggunakan contoh daur ulang untuk alasan kinerja, kondisional menciptakan sebuah contoh dari salah satu keluarga dari kelas yang sama didasarkan pada beberapa nilai properti eksternal , Dan seterusnya. Dalam kasus ini, disarankan untuk mendelegasikan penciptaan untuk kelas pembantu disebut Pabrik [GHJV95] daripada menggunakan kelas disarankan oleh Sang Pencipta. Pabrik dibahas dalam Bab 23. Manfaat Terkait Pola atau Prinsip Rendah kopling (dijelaskan berikutnya) didukung, yang berarti ketergantungan pemeliharaan yang lebih rendah dan peluang yang lebih tinggi untuk digunakan kembali. Kopling mungkin tidak meningkat karena kelas yang dibuat adalah mungkin sudah terlihat pencipta kelas, karena asosiasi yang ada yang memotivasi pilihan sebagai pencipta. Coupling Rendah Pabrik Whole-Part [BMRSS96] menggambarkan pola untuk menentukan objek agregat yang mendukung enkapsulasi komponen.














































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: