Code Monkey home page Code Monkey logo

carbon's People

Contributors

dkleehammer avatar

Stargazers

 avatar

Watchers

 avatar  avatar

carbon's Issues

Should we or shouldn't we store other module injections in current module

Currently we store the other module injections into the current module.

Storing other module injections in the current module create a duplication of storage, but also makes the overall library larger. We could just recognize the usage of a pre-pended module ('Module1.injection') name on the injection name to find the module that contains the injection.

What do you think @halkon

carbon.module creating new module each call

carbon.module is creating a new instance every time it's called, this needs to look into the instance cache to see if it already exists as well as recognizing additional parameters passed in. If there is only a name passed in, we should check the cache, if there is other parameters passed in, we should create/replace any instance that already exists for it.

Simplification

Package should be simplified to give a module back that is a singleton or a factory. This will make the package much smaller, but provide the same functionality as the original carbon that I planned.

Reasons for change:

  1. Since all modules where stored in the exports object (node global or window global), it doesn't make any storage difference and naming conventions can still contain '.', e.g. 'Util.Logger'. The injection process will appear the same to the developer.
  2. Too hard to explain what service and factories are in this project and the difference between carbon and other libs/frameworks. Angular messed up the meaning of a factory in programming, at least as far as I'm concerned. Angular's factory returns the same singleton and is not a factory in my opinion, it's just a wrapper to do some pre-conditioning to the service about to be created. Also, Angular has providers, factories and services, which are all providers, but are also listed as services. To clarify, carbon's 'factory' modules are new instances each time, where the singletons are the exact same instance each time the developer uses/injects it.
  3. Carbon file size was too large. Seeing that the system provides DI for testing and code maintainability, I was wondering why the minified version was nearly 2K. Trimming the fat from modules containing services and factories to returning just modules that are singletons or factories (carbon's version) shrunk the file size down to ~600 bytes. We are just the beginning tool that binds the rest of the code together, hence, then carbon name... that and Atom was taken by github.

Throw error on redefinition

At this time, a developer could try to create a module, service, or factory that already exists and end up with the object that's in the provider store. We need to throw an error on redefinition since the developer should also not be able to replace a service that is already created.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.