Skip to content

Change method name 'generate' to 'createJpeg', 'increase' to 'includeBitmap', 'ensure' to 'loadLibrary', 'build' to 'getImageRequest', 'get' to 'createContext'#2385

Closed
pdhung3012 wants to merge 6 commits into
facebook:masterfrom
pdhung3012:master

Conversation

@pdhung3012

@pdhung3012 pdhung3012 commented Jul 30, 2019

Copy link
Copy Markdown

The class EmptyJpegGenerator is used to generate an empty JPEG image. This method named "generate" is to create a new JPEG image. Thus, the method name "createJpeg" is more intuitive than "generate".

The class BitmapCounter is used to count the Bitmaps. This method named "increase" is to check the bitmap. Thus, the method name "includeBitmap" is more intuitive than "increase".

The class BitmapCounter is used to represent GifImage. This method named 'ensure' is to load library for image processing. Thus, the method name 'loadLibrary' is more intuitive than 'ensure'.

The class ImageUrlsRequestBuilder is used to build ImageUrlsRequest. This method named 'build' is to get a new Image url request. Thus, the method name 'getImageRequest' is more intuitive than 'build'.

The class DefaultFrescoContext is used to represent DefaultFrescoContext. This method named 'get' is to create a context. Thus, the method name 'createContext' is more precise than 'get'.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@pdhung3012 pdhung3012 changed the title Change method name 'generate' to 'createJpeg' Jul 30, 2019
@pdhung3012 pdhung3012 changed the title Change method name 'generate' to 'createJpeg' and change method name 'increase' to 'includeBitmap' Jul 30, 2019
@pdhung3012 pdhung3012 changed the title Change method name 'generate' to 'createJpeg', 'increase' to 'includeBitmap' and 'ensure' to 'loadLibrary' Jul 30, 2019
@pdhung3012 pdhung3012 changed the title Change method name 'generate' to 'createJpeg', 'increase' to 'includeBitmap', 'ensure' to 'loadLibrary', 'build' to 'getImageRequest' Aug 1, 2019

@oprisnik oprisnik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request! Most of these renames do not improve the readability of the code. Please revert ones that are breaking API changes since we do not want to break existing usages.

private static @Nullable Supplier<Boolean> sDebugOverlayEnabledSupplier;

public static synchronized FrescoContext get(Resources resources) {
public static synchronized FrescoContext createContext(Resources resources) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't make sense. It doesn't always create a new instance.

}

public ImageUrlsRequest build() {
public ImageUrlsRequest getImageRequest() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make sense and is a huge breaking API change.

* @return true if and only if bitmap is successfully included in the count
*/
public synchronized boolean increase(Bitmap bitmap) {
public synchronized boolean includeBitmap(Bitmap bitmap) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old name is clearer IMO.

@pdhung3012 pdhung3012 Aug 2, 2019

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your notification. Do you think that, the other case 'generate' to 'createJpeg' and 'ensure' to 'loadLibrary' improve the readability?

@defHLT

defHLT commented Feb 15, 2021

Copy link
Copy Markdown
Contributor

It's unclear that the proposed names are better. Closing as it has been stale for a long time.

@defHLT defHLT closed this Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

5 participants