How OOP is mistreated in Angular #141
Replies: 3 comments 4 replies
-
Hello Armen, First of all thanks form the great article. Ik do have one remark regarding 'a specific service for a component'. Ik use this (anti)-pattern a lot. I use it for every container , but I make sure it is provided at the container itself. With this approach my container-component has a clear specification, while the implementation of this specification is nicely encapsulated in a service. I agree that from an OOP point of vue that this service and component are strongly coupled (I place them in the same folder), but this pattern introduces in my opinion some nice advantages regarding the maintenance and testability of your application. |
Beta Was this translation helpful? Give feedback.
-
Nice article! Regarding Using classes everywhere, I believe this is more of a mapping issue rather than interface vs class. the developer should map the returned data to the appropriate type before using it. and sometimes the returned data fields cannot be used as they are, for instance, due to naming convention, so the developer has to map them. |
Beta Was this translation helpful? Give feedback.
-
I tend to use mostly interfaces, not classes for data mapping. If I need to massage the data, then probably I might consider it. But i don't really like to see too much new Data() all over the place. |
Beta Was this translation helpful? Give feedback.
-
In this article, we focus on discussing the issues that developers face with object oriented programming, and some misconceptions/malpractices that exist withing the Angular community about OOP.
Read the article here.
Beta Was this translation helpful? Give feedback.
All reactions