Skip to content

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 betw…

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-…

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 ov…

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 bus…