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

About MoveToClassSideTransformation #17960

Open
Ducasse opened this issue Mar 8, 2025 · 2 comments
Open

About MoveToClassSideTransformation #17960

Ducasse opened this issue Mar 8, 2025 · 2 comments

Comments

@Ducasse
Copy link
Member

Ducasse commented Mar 8, 2025

Right now RBMoveMethodsToClassSideDriver is implemented as:

scopes: scopesList methods: methods

	scopes := scopesList.
	model := self refactoringScopeOn: scopesList first.
	refactoring := ReCompositeRefactoring new
		               model: model;
		               refactorings: (methods collect: [ :m |
					                RBMoveMethodToClassSideRefactoring
						                model: model
						                method: m
						                class: m origin ])

Let us imagine for a while that we would use RBMoveMethodToClassSideTransformation instead of RBMoveMethodToClassSideRefactoring (see the other issue on the fact that RBMoveMethodToClassRefactoring is not one).

Now let us imagine that we have a class X with two methods m1 and m2 and that the class Y define m2.
With this semantics we will get in trouble because m1 will be moved and the system will break on m2.

So we should check all the precondition upFront and if one is already defined in the target class.
In batch mode with do not do it.
In interactive mode the driver should ask what to do.

@balsa-sarenac what do you think?

Ideally I have the impression that I would also define a separate for doing the transformation.

@balsa-sarenac
Copy link
Member

I agree, it's hard to figure out these cases, good that you noticed. I like that we have more and more examples of ReUpFrontPreconditionCheckingRefactoring.

@Ducasse
Copy link
Member Author

Ducasse commented Mar 13, 2025

Yes this is what I like :)
I plan to make MoveToClassSide not a subclass of MoveToClass and also have a transformation and a refactoring clearly working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Current Iteration
Development

No branches or pull requests

2 participants