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

Clean up code #29

Merged
merged 15 commits into from
Nov 6, 2014
Merged

Clean up code #29

merged 15 commits into from
Nov 6, 2014

Conversation

jschaf
Copy link
Contributor

@jschaf jschaf commented Nov 6, 2014

There's no semantic changes here. Just cleanup for the following thing:

  • Whitespace
  • Consistent Indentation
  • Using app to prefix Photoshop methods
  • Declaring vars at the top level instead of relying on implicit global declarations
  • Replace with-statements

I can squash the commits some more if need be. Lemme know what you think.

@skjorn
Copy link
Collaborator

skjorn commented Nov 6, 2014

Looks good. A few remarks:

  • Breaks after return are just redundant. They serve no purpose and are simply dead code. (LetterCase)
  • You decided to use "app." prefix for global Photoshop API, but you don't use it for custom defined global variables. I suppose it helps you differentiate between these two? Fine by me.
  • What is the purpose of replacing the "with" statements? If anything, you made it less readable. I think they fit nicely in the places they were used. If you're unsure of properties of standard Photoshop objects, just check publicly available documentation. I think it's clear from the context what these might be.
  • You broke my indentation! :-) I prefer to have leading tabs since they can be configured according to preference. And I usually set them to 4 spaces. 8 spaces are way too much. I want to keep it that way. (Unless there's a really good reason not to.)

Otherwise good work. You caught a few glitches there.

I'm gonna merge it and then remove the things I don't like (outlined).

skjorn added a commit that referenced this pull request Nov 6, 2014
@skjorn skjorn merged commit 4930b6e into antipalindrome:master Nov 6, 2014
@jschaf
Copy link
Contributor Author

jschaf commented Nov 6, 2014

  • I agree about the break following return, didn't think that one through all the way.
  • I wanted to put all the global variables in a top level config variable, maybe env, but that seemed a little bit too ambitious for this commit.
  • Replacing the with-statements is taking a page from Javascript. See JavaScript’s with statement and why it’s deprecated. I don't have strong feelings on it. The suggested alternative is to use a short temporary variable.
  • My bad on the indentation. I have Emacs setup for the one true indentation style, spaces :) I'll tweak my settings for tabs.

@skjorn
Copy link
Collaborator

skjorn commented Nov 6, 2014

  • "put all the global variables in a top level config variable" -- I thought about it, but decided not to bother. Declaring them as you did should be enough. Wrapping them in another object just makes calling conventions longer, but gives no real benefits. If it were such a problem, it wouldn't have been possible in JavaScript ;-) Not a problem for such a small script anyway.
  • I can see why some people may frown upon the "with" statement. It can get rather dubious. I took care to use it only where there was no risk of collisions and it was plain what's going on. I don't think Adobe's gonna upgrade their ECMAScript parser any time soon for the deprecation to become a real problem, so I'd just leave it. However, if you feel an urge to replace it with a short 3-letter variable, go ahead. I won't stand in your way.

antipalindrome pushed a commit that referenced this pull request Feb 8, 2020
antipalindrome pushed a commit that referenced this pull request Feb 8, 2020
antipalindrome pushed a commit that referenced this pull request Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants