fflib-apex-common icon indicating copy to clipboard operation
fflib-apex-common copied to clipboard

Circular reference between fflib_SObjectUnitOfWork and fflib_ISObjectUnitOfWork

Open ImJohnMDaniel opened this issue 9 years ago • 3 comments
trafficstars

There is a compilation-only circular reference between fflib_SObjectUnitOfWork and fflib_ISObjectUnitOfWork.

  • fflib_SObjectUnitOfWork implements fflib_ISObjectUnitOfWork
  • fflib_ISObjectUnitOfWork references fflib_SObjectUnitOfWork.IDoWork

You can't compile the interfaces independently of the concrete class.

I would suggest moving fflib_SObjectUnitOfWork.IDoWork out to a standalone file of its own; perhaps "fflib_IDoWork". Does that work for everyone?

Doing so would of course break backward compatibility. IMO, I believe that sometimes that is ok in situations like these.

Thoughts @afawcett and @frup42 ?

ImJohnMDaniel avatar Nov 09 '16 18:11 ImJohnMDaniel

You can't compile the interfaces independently of the concrete class.

Does this actually cause any problems? You can make changes such as changing method signatures either by compiling the classes together, or being careful about the order of changes.

E.g. I want to change method doStuff(String one) to doStuff(String one, String two). Add doStuff(String one, String two) to concrete class. Change doStuff(String one) to doStuff(String one, String two) in interface. Remove doStuff(String one) from concrete class.

Or make the changes in both and then compile both at the same time.

I don't think I entirely understand the problem we're trying to solve.

dfruddffdc avatar Nov 14 '16 08:11 dfruddffdc

Hey @frup42

Does this actually cause any problems?

It is causing a small problem. I am phasing in pieces of the fflib framework to my project. When I was adding the UOW pieces, I noticed the circular reference. I raised the issue just to suggest breaking the circular reference would be a good thing to consider just to keep things clean.

ImJohnMDaniel avatar Nov 14 '16 11:11 ImJohnMDaniel

@afawcett @frup42 - Thoughts? Will it be fixed?

ImJohnMDaniel avatar May 10 '17 12:05 ImJohnMDaniel