JADE Environment Development Ideas

What's new in the upcoming JADE release?

IMPROVED DEVELOPER EFFICIENCY. ENHANCED SECURITY. SMOOTHER INTEGRATION

The JADE 2022 release meets tomorrow’s business demands.


Start your update to JADE's latest release

Adding Interfaces as references on classes

This can be closed. Original Request below.

It appears this was an issue I was running into in 2018. In 2022 I can define a reference of an Interface type just fine. Don't know how I didn't find out sooner.



In a similar vein to 291, I'd like to be able to declare a reference type of an interface for type-safety and improved dev experience, and for designing with composition.

Current state:

Currently in Jade, we have to define an Object reference, and then refer to it everywhere it is used as an interface type explicitly. It feels a bit clunky compared to what I'm used to with C#, but it works. If there's a problem, it throws at runtime.

Potential issues(?):

I imagine interface type declaration wasn't done for concerns around type-safety. Say if the underlying concrete type no longer implements the interface, (maybe we can stop the dev shooting themselves in the foot?) or maybe there are other issues. I imagine there are solutions though, and I'm happy to try work through it below if other issues exist.

I don't see a ton of complexity with this feature - it might get complicated if you also implement inverses and MKDs, but that's out of scope for this.

Request:

I just want what is effectively still a nullable object, just declared as an interface type.


Below is a nice-to-have, where handling calls to a concrete type as an interface is simplified if the concrete type has a member that is of a matching interface type.

For context:

As an example, I have a class which has a reference to an interface type, this class also implements the interface, and maps all methods required by the interface to its member of that same interface type.

Copilot is clever enough to realise what I am doing and makes it a 2 click process regardless of how many methods I have.


The issue:

While Jade does generate all the method maps for you, or maps to existing methods, it doesn't fill out generated methods beyond returning null or doing nothing.


Suggested solution:

If the interface implementer had a reference to an object of that same interface, it'd be nice if Jade could let me select that reference in the interface mapping dialog, and generate mappings to that member for me in the generated methods.


Benefits:

It would save having to go into each generated method, add effectively the same code, and recompile. Especially for interfaces with more than 5 or so methods. (at which point I've found it becomes easier to extract the class as plaintext, do a find/replace for the methods, and re import)


I believe improving ease of use and capability of interfaces in Jade would mean people could more easily refactor existing inheritance-based code, address technical debt, and provide what may be a more maintainable way to implement change to satisfy new business rules or requirements.

  • Kara Heffernan
  • Jan 1 2024
  • Needs review
  • Attach files