Giter Site home page Giter Site logo

Refactoring code about zimjs HOT 4 CLOSED

danzen avatar danzen commented on May 30, 2024
Refactoring code

from zimjs.

Comments (4)

danzen avatar danzen commented on May 30, 2024

Thanks @Mr-Chehata - we did start with modules - as per the sections of the docs. This was based on the ES5 Module pattern as it was pre-ES6-adoption. It was found that as a Framework, the modules are less important to the coder - we almost always use all the modules. The code size issue was solved mostly by ZIM Distill (tree-shaking). The only minor issue there is caching... modules could be cached but Distilled code can be cached per user per app but not across apps.

ES6 modules are not going to work well with our users which range from professionals to kids. We do not want to force a namespace on people and there is no way that we want to slow down developers or kids by making them choose which classes and functions they want to import.

Modules could still come in handy for maintenance - and perhaps for collaboration. But ZIM is almost complete and as a sole creator, was fine for maintaining and building with a few bookmarks, etc.

So on the face of it - yes, modules are scaleable and good code structure... but there is a fair bit going on here. A namespace can be applied if desired by using zns=true before importing ZIM. Our methods are actually zim functions that can work as functions or methods to handle operating on raw CreateJS objects. There is the ZIM DUO technique of passing in parameters or a single configuration object with properties that match the parameter names. There is how distill works to record functions that are used. There is STYLE applied across DisplayObjects and Controls. There is a TypeScript parser that creates over 4000 lines of typing. There is a Docs parser that creates docs from the code. Many of these are easier with one file.

Of course, we are open to discussion, and help yourself to trying to put ZIM in modules, we would lend guidance if you were to try. It is something that we have though much about over the last few years - and fairly firmly decided that that we do not want "upgrade" - same with converting all the code to ES6. There is really no reason that we can see to do this. We have been moving forward with ES6 in examples - for instance, all the CodePen examples. And the ZIM Skool has been updated.

Cheers!

from zimjs.

Mr-Chehata avatar Mr-Chehata commented on May 30, 2024

Thank you @danzen for your explanatory Reply ...
I think this convincing for me , you already try it and seems that isn't a better techno-architecture for the Zim philosophy/culture ...
Thanks

from zimjs.

danzen avatar danzen commented on May 30, 2024

Thank you for caring @Mr-Chehata - we do not mean to put you off hanging around or using ZIM - and we will continue to assess the situation!

from zimjs.

danzen avatar danzen commented on May 30, 2024

Just a note, we have provided ES6 Modules at https://zimjs.com/es6.html#MODULES which wrap the ES5 code with exports. These are for the main ZIM but also for combinations of the libraries

from zimjs.

Related Issues (20)

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.