Skip to content

Refactor apps/files/ajax/newfile.php / Add StreamNotificationToEventSourceProxy class - #7123

Closed
bantu wants to merge 1 commit into
masterfrom
StreamNotificationToEventSourceProxy
Closed

bantu wants to merge 1 commit into
masterfrom
StreamNotificationToEventSourceProxy

Conversation

@bantu

@bantu bantu commented Feb 7, 2014

Copy link
Copy Markdown

Refactor apps/files/ajax/newfile.php

  • Remove global and static variables
  • Remove local untestable function definition
  • Make notification code reusable

@DeepDiver1975 @PVince81

@bantu

bantu commented Apr 29, 2014

Copy link
Copy Markdown
Author

@DeepDiver1975 @PVince81 @icewind1991 @karlitschek @craigpg This is a rather simple refactoring that has been lying around for some time, but still seems to apply. Can we have this?

@PVince81

Copy link
Copy Markdown
Contributor

Is this something you need for another PR ?

The commit comment seems to imply that you did this to make the function testable, but it seems that you didn't add any test for those ?

@bantu

bantu commented Apr 30, 2014

Copy link
Copy Markdown
Author

@PVince81 I only refactored this code to get rid of properties properly organised code does not have: global variables, static variables, untestable functions + I made the code reusable and use dependency injection. All this was done in about 10 minutes. I have not written any actual tests for this code. I did not expect this clearly benefitial change to lie around for 3 months or more.

This PR is somewhat related to #5499 (comment) which might refactor this code even further, but needs further looking into e.g. due to soft quota.

@PVince81

Copy link
Copy Markdown
Contributor

It would be better to only refactor code when it is associated with fixing a specific issue or implementing a feature, so it can be regression tested as part of that feature. Basically only refactor code that you need to touch anyway for any fix/feature, as it will need to be reviewed/tested anyway. This is why I asked.

The refactoring itself might have taken you 10 minutes, but will take more time for reviewers to context switch, dive into the code to understand it, review it, do regression tests (and try to infer test steps from the code if no test plan is provided), time that might be better spent fixing bugs instead, especially that there are still a lot in the tracker.

If you add a unit test that confirms that it still works after refactoring and a mini test plan it might save some time when reviewing it.

@karlitschek

Copy link
Copy Markdown
Contributor

I agree with @PVince81

@bantu

bantu commented Apr 30, 2014

Copy link
Copy Markdown
Author

All right. I'll put this into #5499 then.

@bantu bantu closed this Apr 30, 2014
@LukasReschke
LukasReschke deleted the StreamNotificationToEventSourceProxy branch June 20, 2014 18:20
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants