question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IHandle marker interface needed?

See original GitHub issue

First of all thanks for your great work!

I wonder if you guys can get rid of the IHandle marker interface if you query the generic IHandle<T> interfaces in this fashion:

var interfaces = handler.GetType().GetInterfaces().Where(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IHandle<>));

Or do i omit something?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jonnybicommented, Jun 1, 2017

I personally like the convention over configuration approach most new frameworks follow.

But for me there are drawbacks. All developers are forced to dive deeper into the frameworks too fully understand what’s going on (that’s maybe not a drawback but not all developers on a team are always willing to do this).

If you use multiple of these frameworks you most likely have one or many aspects in your viewmodels that are “hidden”.

For example Fody PropertyChanged moved away from the ImplementPropertyChangedAttribute and as a convention every class that implements INotifyPropertyChanged is automatically weaved. But I like these attributes because they make code more readable.

If caliburn moves away from the handle interfaces and other frameworks follow this approach you have to have a high awareness which frameworks are used in your project. Because an accidently chosen method name could have a huge impact.

I think a good example is the Startup class in asp.net core projects. There is convention used too but the startup is used only for a single purpose and there are only the conventions of a single frame-work you have to know. But in viewmodels you most likely will hit multiple aspects…and then it’s getting messy…

But maybe with developers getting more and more used to the approach these apprehensions will disappear.

0reactions
nigel-sampsoncommented, Jun 2, 2017

I don’t think I want to head down the convention over configuration approach too much for a lot of reasons above. It can cause too much confusion about what’s actually happening under the covers.

We see this already a little with the binding / action conventions the framework already has and I’m not sure doubling down on it is the right idea.

The Fody example is a great one because my understanding is a little different than above in that Fody automatically added weaving to classes already implementing INotifyPropertyChanged and you needed to opt out using a different attribute. ImplementPropertyChangedAttribute was only ever required on classes that wanted weaving but didn’t already implement the interface.

At the moment I’d like to concentrate on things like

  • Removing IHandlle if it’s not being used, as I write this I can think of one reason why it may need to stay.
  • Providing subscriber options for thread dispatching.
  • Considering adding some async love.

At the same time making sure we don’t stand in the way of letting people layer conventions down on top of this in a way that makes sense for them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Marker Interfaces in Java
A marker interface is an interface that doesn't have any methods or constants inside it. It provides run-time type information about objects ...
Read more >
What is the point of marker interface in java and why can't ...
the point of a 'marker' interface is to 'mark' classes. For instance, a class that doesn't implement Serializable either direct or indirect, can ......
Read more >
Marker Interface Isn't a Pattern or a Good Idea
Needing marker interfaces isn't great. But the issue is that you're trying to represent some kind of knowledge about types that the type...
Read more >
What is the necessity of marker interface in Core Java ...
Marker interfaces are empty interfaces with no methods declared. They are used for tagging purpose. Tagging/informing the JVM to handle the classes implementing ......
Read more >
Marker Interfaces in Java - Kasun Dissanayake
Marker interfaces are used to mark a class for a purpose. Purpose does not require any additional functionality.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found