Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensive use of dart extensions #92

Open
rfuerst87 opened this issue Jan 13, 2023 · 4 comments
Open

Extensive use of dart extensions #92

rfuerst87 opened this issue Jan 13, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@rfuerst87
Copy link

While debugging #91 I noticed the extensive use of dart extensions all over the code base. May I ask what the intention behind this design decision is?

As far as I can see I noticed the following pattern:

  • Extensions (with only a few exceptions) are applied to self-owned classes
  • Extensions are all private to their respective classes
  • Some extensions define the same method signatures on classes their applied on

In my opinion all this diminishes readability of the code. Why not use proper interface definitions and plain old methods instead?

Thanks for a quick feedback!

@ghost
Copy link

ghost commented Feb 9, 2023

Hey @rfuerst87, Thanks for sharing your concerns regarding the architecture design. The Rollbar SDK is a relatively new addition to our portfolio hence the unorthodox solutions. We highly appreciate every user feedback, so I'll bring this back to the devs. I'll get back to you whenever I have an update.

@matux matux self-assigned this Mar 15, 2023
@matux matux added the enhancement New feature or request label Mar 15, 2023
@rfuerst87
Copy link
Author

Sorry for my late reply here. Rollbar is not really in my focus these days. However you might wan't to tackle this anyway.

The frist two examples you linked use extensions as intended. They extend functionality of classes Rollbar doesn't control. Such as Iterable and String. They are defined gobally, so that they can be used throughout your codebase. Nothing to "complain" there. However the third example is IMHO questionable. I'm not sure wheter private extensions are useful. Maybe it's a matter of preference, to me it's a private method with extra steps that hurts readability. Also I'm not sure what methods like JsonMap get trace => this['trace']; are good for. Seems like syntax bending.

When I brought up this issue I had cases in mind such as:

Please take this "complaint" with a grain of salt. There might be good reason you defined your classes and extensions like you did and this is fine. I don't have the knowlegde you have when you built this thing, and a lot of design desicions reflect personal preferences. To boil down my issue to one sentence: I have the impressions this library uses extensions for the sake of using extensions, which hurts readability and long-term maintainability.

@ghost
Copy link

ghost commented Jun 5, 2023

@rfuerst87 No worries. Thanks for taking the time and sharing your thoughts, I appreciate your help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants