Skip to content

Simplifying structure of the class ApplicationManagerImpl#13

Open
VadymLuchko wants to merge 3 commits intomasterfrom
refactor/Simplifying_structure_of_the_class_ApplicationManagerImpl
Open

Simplifying structure of the class ApplicationManagerImpl#13
VadymLuchko wants to merge 3 commits intomasterfrom
refactor/Simplifying_structure_of_the_class_ApplicationManagerImpl

Conversation

@VadymLuchko
Copy link

Concentration of various functionality within one class violates the single responsibility principle and makes it difficult to work with the class file.
ApplicationManagerImpl.cc contains more then 5000 lines of code that solve various problems and can be thematically categorized into separate classes.

Copy link

@AKalinich-Luxoft AKalinich-Luxoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLuchko I think it would be more descriptive to attach some UML diagram like this:
ApplicationManager.zip
Screenshot from 2021-10-28 13-33-17

It is easier to read and understand

Comment on lines 11 to 15
To simplify the class ApplicationManagerImpl, some edits are proposed:

- replace some predicates functions with lambdas
- move some functions to appropriates places
- move some methods to separate classes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLuchko this is not a motivation, its better to move down to proposed solution.
Motivation is mostly about which benefits this proposal can give to us.
For example, you can write that ApplicationManagerImpl will be easier to use as all functionality will be regrouped on corresponding calsses. Each class will be more obvious from functionality point of view. etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in c7be02b



Move methods to new sub class `ApplicationDataProvider` because they are have very similar implementation
And probably we could simplify this methods by move coomon part to base class

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
And probably we could simplify this methods by move coomon part to base class
And probably we could simplify these methods by moving common parts to the base class

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in c7be02b

Move methods to new sub class `ApplicationDataProvider` because they are have very similar implementation
And probably we could simplify this methods by move coomon part to base class
```
DataAccessor<ApplicationSet> ApplicationManagerImpl::applications()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLuchko for this list, I would recommend to mention only function names like
applications()
pending_applications()
...

As it is pretty hard to read

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in c7be02b

Comment on lines 105 to 113
Move methods to new class `WayPointsHandler`
```
IsAppSubscribedForWayPoints
SubscribeAppForWayPoints
UnsubscribeAppFromWayPoints
SaveWayPointsMessage
IsAnyAppSubscribedForWayPoints
GetAppsSubscribedForWayPoints
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLuchko maybe we can make a waypoints_plugin for this functionality?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLuchko please add () for each function in the list

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think that it's confusing a bit that SDL RPC plugin is responsible for processing waypoints-related data

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mentioned in c7be02b




Move methods to new class `HMIHandler`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Move methods to new class `HMIHandler`
Move methods to new class `HmiHandler`

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in c7be02b

```


Move methods to new class `NavigationHandler`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLuchko I think this should be merged with StreamingHandler or be a part of it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edited in 5df5aab

```


Move methods to new class `FilesystemHelper`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLuchko we already have file_system as a good place for these functions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in c7be02b

```


Move methods to new class `ApplicationsHandler`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VadymLuchko I think this should be a part of ApplicationDataProvider as it works with the same collection

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edited in 5df5aab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants