OHO-003 JAV # Domain Services and Domain Processes in DDD ## Introduction This article explains the concept of services and processes in Domain Driven Design (DDD). It also discusses the differences between application services and domain services. Mainly, the article provides a practical example of domain services and domain processes in a sample insurance system. Moreover, it shows how to implement this in reality using the C# programming language. ## Domain Services Domain services are part of the domain layer. Some business logic cannot be modeled in an object. Moreover, they represent a specific task that is part of the domain without being an object or a value on their own. Domain services can be model behaviors, interactions, and processes that fall naturally outside the object's responsibility. A domain service is a state-free object that indicates a domain behavior. Here is an example of the domain service in an insurance system: ```java public class InsuranceService : IInsuranceService { public void CalculateInsurance(Flight flight) { // Everything is covered as long as they do not crash return 1.0f; } } ``` ## Domain Processes In domain processes, a process is something that takes time and creates a state change in the domain. If a process is a known phenomenon, then it can be modeled for a state-free object. The domain process is not part of the domain layer but could be part of the infrastructure layer. If it is not a phenomenon, create a task for it. ## Application Services vs Domain Services Application services reside in the application layer. However, domain services reside in the domain layer. Application services are used to control the work of the application and that is why they don't have any business logic. Here is an example of the application service. ```java public class InsuranceService : IInsuranceService { private IInsuranceRepository _InsuranceRepository; private IInsuranceClientRepository _InsuranceClientRepository; private IInsuranceDomainService _InsuranceDomainService; public InsuranceService(IInsuranceRepository _InsuranceRepository, IInsuranceClientRepository _InsuranceClientRepository, IInsuranceDomainService _InsuranceDomainService) { this._InsuranceRepository = _InsuranceRepository; this._InsuranceClientRepository = _InsuranceClientRepository; this._InsuranceDomainService = _InsuranceDomainService; } public void CalculateInsurance(Request flight) { // Get the flight’s category and calculate the premium based on that Insurance flight = flight.GetInsurance(); FlightInsurance task = new FlightInsurance(flight); _InsuranceDomainService.CalculateInsurance(task); } } ``` * Reference: [here](https://www.codeproject.com/Articles/513710/DD-Domain-Services-and-Domain-Processes) * Reference: [here](https://www.codeproject.com/Articles/516654/DD-Application-Services-vs-Domain-Services) ## Conclusion This article explains the concept of services and processes in DDD. It also discusses the differences between application services and domain services. Mainly, the article provides a practical example of domain services and domain processes in a sample insurance system. Pleas follow me on [Linkedin](https://www.linkedin.com/in/mohammadjavad-mor560-06056-microsoft/) page:>https://www.linkedin.com/in/mohammadjavad-mor560-06056-microsoft/ - Cuplikan Gratis dan Subtitle Bahasa Indonesia srt.
Unduh Subtitle OHO-003
English Subtitles
中文字幕
日本語字幕
Subtitle Indonesia
Deutsche Untertitel
Sous-titres Français
Tentang Video Ini
Aktris: Mitsuki An 杏美月
Studio Produksi: Cherries
Tanggal Rilis: 18 Mei, 2012
Durasi: 121 minit
Harga Subtitle: $163.35 $1.35 per menit
Waktu Pesanan Kustom: 5 - 9 hari
Jenis Film: Disensor
Negara Film: Jepang
Bahasa Video: B. Jepang
Format Subtitle: File .srt / .ssa
Ukuran File Subtitle: <121 KB (~8470 baris yang diterjemahkan)
Nama File Subtitle: h_093oho00003.srt
Translation: Terjemahan Manusia (bukan A.I.)
Total Aktris: 1 orang
Resolusi Video dan Ukuran File: 320x240, 480x360, 852x480 (SD)
Lokasi Syuting: Di Rumah / Di Bilk
Jenis Rilis: Penampilan Biasa
Pemeran: Aktris Solo
Kode Video:
Pemilik Hak Cipta: © 2012 DMM
Resolusi Video dan Ukuran File
576p2,737 MB
432p1,828 MB
288p939 MB
144p369 MB