Kuv tuaj yeem siv dto qhov twg?
Kuv tuaj yeem siv dto qhov twg?

Video: Kuv tuaj yeem siv dto qhov twg?

Video: Kuv tuaj yeem siv dto qhov twg?
Video: Laj tsawb-nkauj tawm tshiab ( kênh music hmoob ) ntxhais hmoob tuaj suav teb tuaj 2024, Kaum ib hlis
Anonim

Thaum twg siv tus DTO qauv, koj kuj yuav ua siv ntawm DTO cov khoom sib dhos. Cov assemblers yog siv los tsim DTOs los ntawm Domain Objects, thiab vice versa. Lub ntsiab txhais rau DTO tuaj yeem nrhiav tau ntawm Martin Fowler qhov chaw. DTOs yog siv los hloov cov kev txwv rau txoj hauv kev thiab ua hom rov qab.

Ib yam li ntawd, nws tau nug, Kuv puas xav tau DTO?

DTO raws li lub tswv yim (cov khoom uas nws lub hom phiaj yog los sau cov ntaub ntawv xa rov qab mus rau tus neeg siv khoom los ntawm lub server) yeej tsis yog qhov qub. Rau ntau daim ntawv thov complex koj tsis ua xav kom nthuav tawm tag nrho cov qauv sau rau tus neeg siv khoom, yog li daim ntawv qhia los ntawm cov qauv sau rau DTOs yog tsim nyog.

Dab tsi yog qhov txawv ntawm qhov chaw thiab DTO? Qhov sib txawv ntawm DTO & Qhov chaw : Qhov chaw yog chav kawm mapped rau lub rooj. Dto yog chav kawm mapped rau "saib" txheej feem ntau. Yam yuav tsum tau khaws cia yog qhov chaw & uas yuav tsum tau 'qhia' ntawm nplooj ntawv web yog DTO.

Hauv qhov no, DTO qauv yog dab tsi?

Ib Qhov Kev Hloov Cov Ntaub Ntawv ( DTO ) yog ib qho khoom siv los nqa cov ntaub ntawv, piv txwv li ntawm tus neeg siv khoom thiab lub server lossis nruab nrab ntawm UI thiab cov txheej txheem sau npe. Qee zaum a DTO tuaj yeem pom raws li tus kab mob anemic qauv . DTOs feem ntau yog siv tawm ntawm lub hexagon, nyob rau hauv tus me nyuam mechanism.

Qhov txawv ntawm POJO thiab DTO yog dab tsi?

A DTO feem ntau tsis yog dawb huv POJ . Nws feem ntau khi rau lub moj khaum uas pr POJ stands rau Plain Old Java Object thiab lub sij hawm tau tsim los piav txog cov khoom uas tsis muaj tshwj xeeb khi rau ib lub moj khaum. Cov khoom qub.

Pom zoo: