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

Hide COM objects behind API #1697

Closed
ghost opened this issue Jun 4, 2016 · 3 comments
Closed

Hide COM objects behind API #1697

ghost opened this issue Jun 4, 2016 · 3 comments
Labels
enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point.
Milestone

Comments

@ghost
Copy link

ghost commented Jun 4, 2016

I'm not sure if an issue is the right place for this so if it isn't, feel free to close it.

How about we create our own object model for the COM objects we work with (VBProject, VBComponent, ...). This way we could deal with all the oddities of COM in one place and the rest of the codebase gets to deal with "normal" classes without having to bother with COM exceptions and the like. E.g. on load we translate the VBProject+VBComponents into our own object model, similar to an ORM I suppose.

If we have to get the current state we simply refresh the object. Manipulating code, exporting a module and the like could be hidden behind their interfaces, they in turn could use this new structure to get the component, do the change and then quickly get rid of the component again.

This also has the advantage that we don't have to deal with VBProjects etc. in our unit tests. The mocks would get easier. It also has the advantage that we automatically work with snapshots (right now you can cause a parser error if you change the code while it is parsing, because the parser doesn't actually work with a snapshot).

Any thoughts on this?

Edit: This could also be the first step towards making the vba compiler independent of the VBE, allowing it to be used anywhere, e.g. for writing web applications in VBA.

@ThunderFrame
Copy link
Member

IIUC that would mean the consumer of type information wouldn't need to know the difference between a COM object and a VBA object. That would make things like a new Object Browser and intellisense much eeasier too.

@ghost
Copy link
Author

ghost commented Jun 5, 2016

I feel like we're talking about different things? What I meant is that we don't use e.g. VBComponent anywhere in code but at one place, where it would be used to create a "normal" CLR class. We would simply extract all information we need (e.g. the name, display name, ...). The rest of the codebase would only use those non-COM classes.

@retailcoder retailcoder added enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point. and removed feature-reflection-api feature-request labels Nov 21, 2016
@retailcoder retailcoder added this to the Version 2.0 milestone Nov 21, 2016
@retailcoder
Copy link
Member

This has been implented; as of 2.0.10 all of Rubberduck depends on wrapper interfaces, that are implemented using VBA's VBIDE API, and can be implemented using VB6's VBIDE API too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point.
Projects
None yet
Development

No branches or pull requests

3 participants