square / okhttp

Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

Home Page:https://square.github.io/okhttp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Potential Refactoring

alvintanjianjia opened this issue · comments

Summary

I have identified a few classes with refactoring potential, could it be possible to improve these classes further? I am probably not qualified and experienced enough to point out the exact code needs to be refactored, given my limited knowledge of the project and codebase.

Urgency

Low priority. For maintenance of code in the long run.

Hi,

I am currently doing some research on Estimating Time Taken for Software Refactoring. Okhttp is one of my case studies being a highly popular project. Would appreciate your kind feedback on the appropriateness of the estimated time to refactor.

I am specifically looking at potential for refactoring, such as breaking functions that are too long into shorter functions, or to remove code duplication. Would you agree that there could be some modification to the code to make it better in the listed classes? And if so, is the estimated time appropriate to carry out the improvement? I will be grateful for any help you can provide.

  1. AccessHeaders.java - 1 hour
  2. AsynchronousGet.java - 1 hour
  3. Authenticate.java - 1 hour
  4. CacheResponse.java - 1 hour
  5. CancelCall.java - 2.5 hours
  6. Case.java - 2 hours
  7. CertificatePinning.java - 1 hour
  8. CheckHandshake.java - 2 hours
  9. ConfigureTimeouts.java - 1 hour
  10. CurrentDateHeader.java - 1 hour
  11. CustomCipherSuites.java - 3.5 hours
  12. CustomTrust.java - 5 hours
  13. GetExample.java - 1.5 hours
  14. HpackJsonUtil.java - 2.5 hours
  15. HttpsServer.java - 2 hours
  16. PostExample.java - 1 hours
  17. Story.java - 1.5 hours

Thank you once again for any help you can provide.

Regards,

Alvin

These estimates seem plausible, though the scope is completely vague.

We won't accept pull requests for such refactorings if that's your intention. Usually our code violates style rules in service of some other goal; typically performance.

Hi @swankjesse,

Thank you so much for your inputs! I totally agree that the scope is very vague. I do not think that I am qualified enough to propose changes given my limited experience to the code base. I am hoping to work with someone experienced on the project. For the listed classes, if you feel that there could be refactoring carried out to improve the classes, I hope to track the time required for you to carry out the refactoring activity.

I am trying to obtain developer feedback on whether my research is accurate in

  1. Pointing out areas that require refactoring.
  2. Estimating the time required for refactoring.

Estimated Time

The estimated time here is given by a model trained on all of the previous refactoring activities on Okhttp, taking into account the refactored class dependencies, line of code involved, number of methods involved, complexity of code etc. It is a rough estimate here estimating the time required for refactoring.

The specifics of the research can be found at https://github.com/alvintanjianjia/SoftwareRemodularization. Please let me know if you require more details, or are there any areas that I can help to make this process easier.

Thank you.

Regards,

Alvin

I'm sorry I can't help further with this exercise.