MotivationAll the time we design a program module and we create some c translation - MotivationAll the time we design a program module and we create some c Indonesian how to say

MotivationAll the time we design a

Motivation

All the time we design a program module and we create some class hierarchies. Then we extend some classes creating some derived classes.

We must make sure that the new derived classes just extend without replacing the functionality of old classes. Otherwise the new classes can produce undesired effects when they are used in existing program modules.

Likov's Substitution Principle states that if a program module is using a Base class, then the reference to the Base class can be replaced with a Derived class without affecting the functionality of the program module.
Intent

Derived types must be completely substitutable for their base types.
Example

Below is the classic example for which the Likov's Substitution Principle is violated. In the example 2 classes are used: Rectangle and Square. Let's assume that the Rectangle object is used somewhere in the application. We extend the application and add the Square class. The square class is returned by a factory pattern, based on some conditions and we don't know the exact what type of object will be returned. But we know it's a Rectangle. We get the rectangle object, set the width to 5 and height to 10 and get the area. For a rectangle with width 5 and height 10 the area should be 50. Instead the result will be 100

This principle is just an extension of the Open Close Principle and it means that we must make sure that new derived classes are extending the base classes without changing their behavior.


0/5000
From: -
To: -
Results (Indonesian) 1: [Copy]
Copied!
MotivationAll the time we design a program module and we create some class hierarchies. Then we extend some classes creating some derived classes.We must make sure that the new derived classes just extend without replacing the functionality of old classes. Otherwise the new classes can produce undesired effects when they are used in existing program modules.Likov's Substitution Principle states that if a program module is using a Base class, then the reference to the Base class can be replaced with a Derived class without affecting the functionality of the program module.IntentDerived types must be completely substitutable for their base types.ExampleBelow is the classic example for which the Likov's Substitution Principle is violated. In the example 2 classes are used: Rectangle and Square. Let's assume that the Rectangle object is used somewhere in the application. We extend the application and add the Square class. The square class is returned by a factory pattern, based on some conditions and we don't know the exact what type of object will be returned. But we know it's a Rectangle. We get the rectangle object, set the width to 5 and height to 10 and get the area. For a rectangle with width 5 and height 10 the area should be 50. Instead the result will be 100 This principle is just an extension of the Open Close Principle and it means that we must make sure that new derived classes are extending the base classes without changing their behavior.
Being translated, please wait..
Results (Indonesian) 2:[Copy]
Copied!
Motivasi Semua waktu kita merancang modul program dan kami membuat beberapa hierarki kelas. Kemudian kami memperluas beberapa kelas menciptakan beberapa kelas turunan. Kita harus memastikan bahwa kelas turunan baru saja memperpanjang tanpa mengganti fungsi dari kelas tua. Jika tidak kelas baru dapat menghasilkan efek yang tidak diinginkan ketika mereka digunakan dalam modul program yang ada. Likov ini Pergantian Prinsip menyatakan bahwa jika modul program menggunakan kelas Base, maka referensi ke kelas Base bisa diganti dengan kelas Berasal tanpa mempengaruhi fungsi program modul. Intent Berasal jenis harus benar-benar disubstitusikan untuk jenis basis mereka. Contoh Berikut adalah contoh klasik dimana Likov ini Pergantian Prinsip dilanggar. Dalam contoh 2 kelas yang digunakan: Rectangle dan Square. Mari kita berasumsi bahwa objek Rectangle digunakan di suatu tempat di aplikasi. Kami memperluas aplikasi dan menambahkan kelas Square. Kelas persegi dikembalikan oleh pola pabrik, didasarkan pada beberapa kondisi dan kita tidak tahu persis apa jenis objek akan dikembalikan. Tapi kami tahu itu Rectangle a. Kami mendapatkan obyek persegi panjang, mengatur lebar untuk 5 dan tinggi 10 dan daerah. Untuk persegi panjang dengan lebar 5 dan tinggi 10 daerah harus 50. Sebaliknya hasilnya akan 100 Prinsip ini hanyalah perpanjangan dari Buka Tutup Prinsip dan itu berarti bahwa kita harus memastikan bahwa kelas turunan baru memperpanjang kelas dasar tanpa mengubah perilaku mereka.
















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 ©2025 I Love Translation. All reserved.

E-mail: