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.

Implement interfaces and abstract classes

See original GitHub issue

At the moment we have classes that are named like ConnectionInterface, using an Interface suffix to indicate that they have implementation expectations.

Those classes are actually abstract classes and should be refactored to behave like one. There are a few exceptions which are or should actually be interfaces that are implemented by other classes instead of extending an abstract class.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
faustbriancommented, Dec 27, 2018

They would be managed in the same repository. I would restructure the repository to contain 3 folders that are managed by lerna as essentials, optional and types.

  • essentials would be packages that are required to run a node like blockchain, pool, etc.
  • optional would be packages like api, webhooks, etc.
  • types would be packages that contain only the type defs
0reactions
paroxysmcommented, Dec 28, 2018

So, I thought about it some more, and even in their own types modules, you’d still have the circular dependency problem if your interfaces need to reference each other(method parameters or instance properties). If they’re all in a single module, they can all see each other so it’s all good, but if they’re in different modules, the types modules would have to have dependencies on each other and you run into the same problem, introducing a circular dependency among the types modules.

The only way that would work is if the dependencies are realized(so app.resolvePlugin<ImportedType>) in the concrete implementation, not on the interface layer, i.e interface Blockchain { get transactionPool() : TransactionPool }. But that isn’t a good approach because it restricts how you write your interfaces(to make sure you don’t reference a type what would result in a circular dependency)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implement Interface using Abstract Class in Java
Interface contains only abstract methods that can't be instantiated and it is declared by keyword interface. A class that is declared with ...
Read more >
Why an abstract class implementing an interface can miss the ...
Interface means a class that has no implementation of its method, but with just declaration. Other hand, abstract ...
Read more >
Java Interface and Abstract Class Tutorial With Examples
When an interface is implemented by a class, then it provides an implementation for all the abstract methods of the interface. Similarly, all ......
Read more >
Abstract Class vs Interface in Java – Difference Between Them
An abstract class permits you to make functionality that subclasses can implement or override whereas an interface only permits you to state ...
Read more >
Using an Interface vs. Abstract Class in Java - Baeldung
Any interface with a single abstract method other than static and default methods is considered a functional interface. We can use this feature ......
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