Skip to content
Advertisement

Tag: oop

How to represent bi-directional associations in UML?

After reading the question “In UML class diagram can composition be bidirectional?”, I’m wondering how concrete examples of bi-directional shared/composite aggregation will look on a UML diagram. Specifically, I’m interested how arrow-heads and multiplicity are used to distinguish between the following cases: 1) Uni-directional shared aggregation (aggregation) 2) Bi-directional shared aggregation (aggregation) 3) Uni-directional composite aggregation (composition) 4) Bi-directional composite

How would you convert this method into a ternary expression?

I want to convert those if-statements into a ternary operator expression, but I’ve been struggling since I haven’t had the need to use them that much. The code essentially replaces the characters ‘1’ with ‘i’, removes characters that are not letters, and also removes upper-case letters by enqueuing elements that don’t meet those conditions. Edit: thanks for your comments, code

Making method generic and attributes

I am using quite a similar method for 4, 5 screens basically to do same thing on List of different objects. Now I extracted that method to reuse it and make it generic. Now while making a list generic I face the issue with attributes. It’s attributes are no longer accessible when made generic. How to overcome this issue. Please

Are API calls in a mapper considered a bad practice?

It’s quite common to use DTOs as API models. Often you need to map those DTOs to other models afterwards. I will keep it really simple with following example: So in the above case RequestDto is the model that is used in the API and SomeModel is the model that is used internally by the server for the business logic.

Composition or Inheritance for classes with almost similar implementations but different input and outputs for methods?

I have the following classes, which have quite similar method implementations. Only the classes’ method inputs and outputs seem to be of different types. When I put it like this, it sounds like a case for inheritance, however, the fact that the inputs and outputs are different and are related to two lambdas, make me wonder if they should remain

Advertisement