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

Improvement/alias queue #1156

Merged
merged 10 commits into from
May 18, 2017
Merged

Improvement/alias queue #1156

merged 10 commits into from
May 18, 2017

Conversation

dbemiller
Copy link
Contributor

Type of change

[x] Feature

Description of change

This fixes #1124 (Deprecateque in favor of queue)

Copy link
Collaborator

@protonate protonate left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @dbemiller!

@snapwich
Copy link
Collaborator

this isn't an alias, this is a replacement.

@protonate
Copy link
Collaborator

ah whoops yep gotta add the alias too, can't break the api, nice catch @snapwich

Copy link
Collaborator

@protonate protonate left a comment

Choose a reason for hiding this comment

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

pbjs.que needs to continue to work

@mkendall07
Copy link
Member

Isn't the alias defined in prebidGlobal.js ?

@snapwich
Copy link
Collaborator

@mkendall07

window.$$PREBID_GLOBAL$$.que = window.$$PREBID_GLOBAL$$.que || window.$$PREBID_GLOBAL$$.queue;

won't work since all the operations have been renamed to operate on pbjs.queue.

the operations should probably be unchanged to still operate on pbjs.que and then the alias should be something like

window.$$PREBID_GLOBAL$$.que = window.$$PREBID_GLOBAL$$.que || window.$$PREBID_GLOBAL$$.queue || [];

@snapwich
Copy link
Collaborator

forgot one thing... both pbjs.que.push and pbjs.queue.push need to be monkey-patched.

@dbemiller
Copy link
Contributor Author

Thanks guys. I didn't fully understand what the queue was trying to accomplish, before making those changes. I definitely don't intend to break backwards compatibility.

The latest changes split que from queue, log warnings for people who are using the deprecated method, and add a bunch of unit tests.

src/prebid.js Outdated
$$PREBID_GLOBAL$$.que[i].call();
$$PREBID_GLOBAL$$.que[i].called = true;
if (deprecationWarning) {
utils.logWarn('$$PREBID_GLOBAL$$.que.push is deprecated, to be removed in v1.0.0. Use $$PREBID_GLOBAL.queue.push instead.');
Copy link
Member

Choose a reason for hiding this comment

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

This is going to spam the console with deprecation warnings for all consumers of prebid.js. Probably should only display it once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I must admit... I had kind of intended to spam them :p. The more annoying it is, the faster people will want to update their code ^^.

I must admit there's no substantive benefit, though. I pulled the warning out of the loop.

@nanek
Copy link
Contributor

nanek commented Apr 27, 2017

It is possible to just add an alias for queue as suggested in #1124 instead of deprecating que? Then this doesn't have the side effect of breaking all existing code for all customers, documentation and examples. As a user of prebid I prefer the original intent for the naming of being short as stated in #1124, and i'm not opposed to adding an alias if it helps others. However it does seem a little rushed to make que deprecated and a breaking change for all customers without a good benefit.

@dbemiller
Copy link
Contributor Author

So... it sounds like there are two issues here.


  1. Should Prebid as a project use short names, or descriptive ones?

I'm very new to the project, so if I've missed decisions about [1], please point me to them. In isolation, though, I would argue for descriptive names in APIs for several reasons:

  • They make your code read like English, which makes it easier to understand
  • They minimize the barrier to entry, since newcomers don't have to learn your acronyms or find your documentation to understand your example code
  • They're self-describing, so that "occasional" Prebid programmers who come back to their code a month or two later will remember more easily what the function does.

Let me know if you have more reasons than these... but the only benefits I can come up with in favor of shorter names are:

  • They have a (very tiny) performance benefit
  • They require fewer keystrokes for people code in an environment which doesn't autocomplete.

I definitely don't want to upset the project philosophy if you've already had this discussion... but in a vacuum, descriptive names have always seemed more beneficial to me. Truth be told, even queue isn't totally descriptive... but it's clearer than que :).


  1. How much community disruption are these changes worth?

I simply don't know the Prebid community well enough yet to judge this, for such a small change.

In general, though, API changes should be expected in a v0 project.

@mkendall07
Copy link
Member

@nanek
This wouldn't be a breaking change until 1.0.

@snapwich
Copy link
Collaborator

As I mentioned in another thread, if we're going to make backwards-compatible breaking changes, I'd recommend cmd. It's a common term. It's still short. It's what google uses so you get the shared education on the terminology.

@dbemiller
Copy link
Contributor Author

We chatted a bit about it here and agreed that it was probably not a big enough API change to bother bugging publishers with deprecation warnings.

So... this should be ready for another look now.

@mkendall07
Copy link
Member

@prebid/all-contributors
Please vote on renaming the command queue in prebid.js:

  1. pbjs.cmd
  2. pbjs.queue

Use 👍 or 👎 in the following posts to vote. Thanks

@mkendall07
Copy link
Member

  1. pbjs.cmd

@mkendall07
Copy link
Member

  1. pbjs.queue

@dbemiller
Copy link
Contributor Author

Looks like there's a pretty clear winner ^^. Renamed to cmd now.

@mkendall07 mkendall07 merged commit 29a521e into master May 18, 2017
@mkendall07 mkendall07 deleted the improvement/alias-queue branch May 19, 2017 00:42
outoftime pushed a commit to Genius/Prebid.js that referenced this pull request May 24, 2017
…built

* 'master' of https://github.com/prebid/Prebid.js: (23 commits)
  Increment pre version
  Probed 0.24.0 Release
  Beachfront adapter - add ad unit size (prebid#1183)
  Thoughtleadr adapter - fix postMessage (prebid#1207)
  When prebid server issues a no-bid response, call addBidResponse for every adUnit requested (prebid#1204)
  Improvement/timeout xhr (prebid#1172)
  Add native support (prebid#1072)
  Improvement/alias queue (prebid#1156)
  Updated documentaion (prebid#1160)
  Improvement/prebid iframes amp pages (prebid#1119)
  Fixes prebid#1114 possible xss issue (prebid#1186)
  Allowed setTargetingForGPTAsync() to target specific ad unit codes. (prebid#1158)
  updated tag (prebid#1212)
  Common user-sync (prebid#1144)
  Rename secureCreatives file and lint (prebid#1203)
  HIRO Media: Remove batching mechanism and use AJAX instead of JSONP (prebid#1133)
  Add Support for DigiTrust in Rubicon Adapter (prebid#1201)
  Upgrade linters to ESLint with stricter code style (prebid#1111)
  Add dynamic bidfloor parameter to Smart Adserver Adapter (prebid#1194)
  Bug fix: bids served by secure creatives does not get pushed into _winningBids (prebid#1192)
  ...
vzhukovsky added a commit to aol/Prebid.js that referenced this pull request Jul 17, 2017
….23.0 to aolgithub-master

* commit '136fc37637749a764070c35c03e7e87a5c157947': (33 commits)
  Added changelog entry.
  Implemented passing key values feature.
  Update code to ESlint rules.
  Prebid 0.24.1 Release
  tests: drop ie9 browserstack test
  Audience Network: separate size from format (prebid#1218)
  Bugfix/target filtering api fix (prebid#1220)
  Map sponsor request param to endpoint param (prebid#1219)
  Increment pre version
  Probed 0.24.0 Release
  Beachfront adapter - add ad unit size (prebid#1183)
  Thoughtleadr adapter - fix postMessage (prebid#1207)
  When prebid server issues a no-bid response, call addBidResponse for every adUnit requested (prebid#1204)
  Improvement/timeout xhr (prebid#1172)
  Add native support (prebid#1072)
  Improvement/alias queue (prebid#1156)
  Updated documentaion (prebid#1160)
  Improvement/prebid iframes amp pages (prebid#1119)
  Fixes prebid#1114 possible xss issue (prebid#1186)
  Allowed setTargetingForGPTAsync() to target specific ad unit codes. (prebid#1158)
  ...
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* Replaced que with queue. Made the line terminator characters in pbjs_example_gpt.html be unix-like, rather than windows-like.

* Removed some redundant tests.

* Separated que from queue, and added a deprecation warning. Wrote unit tests.

* Limited the number of deprecation warnings to at most 2.

* Style fixes.

* Removed the deprecation warnings.

* Renamed queue to cmd, per the github poll.

* Fixed two more occurrences of outdated strings/comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

¿Que?
6 participants