You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
-
The question is not so much if you call a de serialized object from a JSON response a dto or "an-object-from-the-wire". The question is: Is it ok to manipulate the prototype chain of such an object that I de serialized from JSON? If you call the result of such an operation a dto or something else is not the point for this particular discussion... I agree that architecture is not a religion and you have to decide for your particular application what's best.morpheus05– morpheus052023-05-04 21:00:03 +00:00Commented May 4, 2023 at 21:00
-
1@morpheus05: The question about prototype cannot be answered before you explain the reasons why you have DTOs. What exactly are these reasons? If all attributes of objects in DB and in DTOs are the same, then you don't need DTOs. If there are reasons to have DTOs (e.g. you want to separate REST layer from the business logic layer, or you validation of DTOs, etc.), then changing prototype will break these reasons. So, please answer, why do you have DTOs at all?mentallurg– mentallurg2023-05-04 21:37:29 +00:00Commented May 4, 2023 at 21:37
-
1A) How would you name an object you parse from a JSON response? - You first name, then parse. If you need DTOs, this can be DTO. If you don't use DTO layer, this can be BO. As I said, first decide if you need DTOs.mentallurg– mentallurg2023-05-04 22:34:37 +00:00Commented May 4, 2023 at 22:34
-
1B) "for that case where they are not you introduce dtos into your application" - Do you mean, there are DTOs and it was not your decision, and you cannot change it? If yes, then again, first ask what is the reason for DTOs. If there is a reason, then changing prototype can break it. If there is no reason, don't use DTOs.mentallurg– mentallurg2023-05-04 22:37:33 +00:00Commented May 4, 2023 at 22:37
-
1We cannot discuss abstract cases, with unknown reasons for particular decisions. That's why please be specific. Describe a specific case (or few specific cases, each separately), explain what were the reasons to use DTOs. Only then we can proceed to the question about prototypes.mentallurg– mentallurg2023-05-04 22:44:28 +00:00Commented May 4, 2023 at 22:44
|
Show 2 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-js