3 ms·
You'll still have the DAO and the DTOs in a functional language - they're types which represent concepts outside of the bounds of your system (well, process).
by radicalbyte 12y ago
You'll still have the DAO and the DTOs in a functional language - they're types which represent concepts outside of the bounds of your system (well, process).
Consider a simple information system consisting of a database and a web service publishing a REST/JSON API. The web service will need a definition of the interface between itself and the database (the DAO) and a definition of the interface between itself and the outside world (the DTO).
Defining both interfaces explicitly allows you to control change and accessibility of data. I.e. you don't have to expose your database to consumers of the web service.
I'd love it if my OO language of choice (C#) could add a special non-polymorphic type to represent these concepts, because then you could do cool stuff like define the DTO in terms of the DAO. "The DTO is all properties of the DAO except propertyX and propertyY".