Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

I agree object notation would look cleaner object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it, grouping them doesn't sound convincing.

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, to me, this package looks like a "God module".

Not that there's something wrong with it, if you meant it to be all-the-utilities-I-will-ever-need kind of module. I wasn't sure from your question if you meant it.

The nice thing about separating even small utilities is that you can

  • open source them because they are decoupled from your code, and others can hack on them;

  • replace them one by one with different implementations;

  • they are immune to "specifics creep", i.e. the situation when over time your once-generic utilities become too tightly coupled to one specific project, and grow too difficult to disentangle so you have to rewrite them once again for your next project.

I agree object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it, grouping them doesn't sound convincing.

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, to me, this package looks like a "God module".

Not that there's something wrong with it, if you meant it to be all-the-utilities-I-will-ever-need kind of module. I wasn't sure from your question if you meant it.

The nice thing about separating even small utilities is that you can

  • open source them because they are decoupled from your code, and others can hack on them;

  • replace them one by one with different implementations;

  • they are immune to "specifics creep", i.e. the situation when over time your once-generic utilities become too tightly coupled to one specific project, and grow too difficult to disentangle so you have to rewrite them once again for your next project.

I agree object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it, grouping them doesn't sound convincing.

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, to me, this package looks like a "God module".

Not that there's something wrong with it, if you meant it to be all-the-utilities-I-will-ever-need kind of module. I wasn't sure from your question if you meant it.

The nice thing about separating even small utilities is that you can

  • open source them because they are decoupled from your code, and others can hack on them;

  • replace them one by one with different implementations;

  • they are immune to "specifics creep", i.e. the situation when over time your once-generic utilities become too tightly coupled to one specific project, and grow too difficult to disentangle so you have to rewrite them once again for your next project.

added 61 characters in body
Source Link
Dan
  • 1.5k
  • 9
  • 19

I agree object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it, grouping them doesn't sound convincing.

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, to me, this package looks like a "God module".

Not that there's something wrong with it, if you meant it to be all-the-utilities-I-will-ever-need kind of module. I wasn't sure from your question if you meant it.

The nice thing about separating even small utilities is that you can

  • open source them because they are decoupled from your code, and others can hack on them;

  • replace them one by one with different implementations;

  • they are immune to "specifics creep", i.e. the situation when over time your once-generic utilities become too tightly coupled to one specific project, and grow too difficult to disentangle so you have to rewrite them once again for your next project.

I agree object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it, grouping them doesn't sound convincing.

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, to me, this package looks like a "God module".

Not that there's something wrong with it, if you meant it to be all-the-utilities-I-will-ever-need kind of module. I wasn't sure from your question if you meant it.

The nice thing about separating even small utilities is that you can

  • open source them because they are decoupled from your code, and others can hack on them;

  • they are immune to "specifics creep", i.e. the situation when over time your once-generic utilities become too tightly coupled to one specific project, and grow too difficult to disentangle so you have to rewrite them once again for your next project.

I agree object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it, grouping them doesn't sound convincing.

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, to me, this package looks like a "God module".

Not that there's something wrong with it, if you meant it to be all-the-utilities-I-will-ever-need kind of module. I wasn't sure from your question if you meant it.

The nice thing about separating even small utilities is that you can

  • open source them because they are decoupled from your code, and others can hack on them;

  • replace them one by one with different implementations;

  • they are immune to "specifics creep", i.e. the situation when over time your once-generic utilities become too tightly coupled to one specific project, and grow too difficult to disentangle so you have to rewrite them once again for your next project.

added 598 characters in body
Source Link
Dan
  • 1.5k
  • 9
  • 19

I agree object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it ("this can be the DOM or other packages"), grouping them sounds like an abstraction out of thin air:doesn't sound convincing.

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, to me, this package has a smell oflooks like a "God module".

Not that there's something wrong with it, if you meant it to be all-the-utilities-I-will-ever-need kind of module. I wasn't sure from your question if you meant it.

The nice thing about separating even small utilities is that you can

  • open source them because they are decoupled from your code, and others can hack on them;

  • they are immune to "specifics creep", i.e. the situation when over time your once-generic utilities become too tightly coupled to one specific project, and grow too difficult to disentangle so you have to rewrite them once again for your next project.

I agree object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it ("this can be the DOM or other packages"), grouping them sounds like an abstraction out of thin air:

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, this package has a smell of a "God module".

I agree object notation would look cleaner in this case.

I don't see why you need Reg. It's a very thin wrapper over an object.
There's no need to implement "registry pattern" in JS because every JS object already is a "registry".

I'm not sure why you need a Debug helper that loads and unloads external scripts or styles. In fact, I don't understand its purpose at all: addTags accepts a tag parameter, which presumably is a string (you're using it as a key), but supposedly the first call will do nothing, since hold[tag] will be empty. Do I need to call removeTags first? What is a tag anyway? The code seems simple, but I fail to understand what it does and how you use it. Maybe you need to ditch simple names in favor of more descriptive ones?

As for putting these utilities under a common umbrella of a "package for outer-package communications", I stay unconvinced. These utilities have little to do with each other, and the way you describe it, grouping them doesn't sound convincing.

By outer-package, I mean outside of this package - this can be the DOM or other packages. This package has a basic event system and a basic registry. It also has a debugger which allows you to fiddle with the DOM by removing and adding entire sets of tags. Later it might have things which allow it to Debug / Configure the server via ajax.

It may seem like each module needs a registry, or some debug tools, or event system, but you can already achieve this without grouping them:

  • put Pubsub separately and make it a mixin like Backbone.Events;

  • debug tools can also be kept separately;

  • any JS object is a "registry" so no real need for that.

Otherwise, to me, this package looks like a "God module".

Not that there's something wrong with it, if you meant it to be all-the-utilities-I-will-ever-need kind of module. I wasn't sure from your question if you meant it.

The nice thing about separating even small utilities is that you can

  • open source them because they are decoupled from your code, and others can hack on them;

  • they are immune to "specifics creep", i.e. the situation when over time your once-generic utilities become too tightly coupled to one specific project, and grow too difficult to disentangle so you have to rewrite them once again for your next project.

Source Link
Dan
  • 1.5k
  • 9
  • 19
Loading
default

AltStyle によって変換されたページ (->オリジナル) /