Performance: Nested DTOs
MEDIUM IMPACT
Nested DTOs affect the data serialization and deserialization time during API calls, impacting response time and client rendering speed.
public class OrderDTO { private String customerName; private String customerCity; private List<String> productNames; // getters and setters }
public class OrderDTO { private CustomerDTO customer; private List<ProductDTO> products; // getters and setters } public class CustomerDTO { private AddressDTO address; // getters and setters } public class AddressDTO { private String street; private String city; private CountryDTO country; // getters and setters } public class CountryDTO { private String name; private String code; // getters and setters }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Deeply Nested DTOs | High due to complex data binding | Multiple reflows possible if UI updates per nested data | High paint cost from large DOM updates | [X] Bad |
| Flattened DTOs | Lower DOM operations | Single reflow after data binding | Lower paint cost with simpler DOM | [OK] Good |