SReject / JSON-For-Mirc

JSON parser for mIRC
19 stars 6 forks source link

Modularize? #44

Closed SReject closed 6 years ago

SReject commented 6 years ago

I've been thinking about modularizing my JSON script as it has alot of individual parts that can be used by other similar scripts I have in the works. For example, my JSON script contains HTTP functionality, JSON parsing functionality, and alot of generic internals.

Would anyone be opposed to me breaking it up into multiple files such as

The advantage is I'd be able to focus on specific functionality instead of having to having to essentially re-code then recompile the script with each new release.

The disadvantage is the loading/updating methodology would be more complicated as, instead of loading a single script, you would load multiple scripts that contain various functionality.

--

Edit 1: The reason modularizing would be beneficial is that it makes development of separate projects that have duplicate functionality quite a bit easier. As an example, I have an XML/HTML parser in the works with with same HTTP functionality as the current JSON parser. As of now it seems excessive of me to manage what is essentially the same HTTP code for both scripts when, instead, I could have a modularized setup where by updating the HTTP script it would update for both the JSON parser and the XML/HTML parser

Travis-Britz commented 6 years ago

What if you maintain them separately but have a script that automatically combines them into a "build" version?

SReject commented 6 years ago

I've thought about this as well. The issue is that mIRC doesn't have a set of build tools like other languages. so I'd end up having to create/maintain a script to it, and that isn't taking into consideration concating and minifying the JS so its usable by mIRC.

If I do decide to go with a modularized approach SRCore.mrc would, most likely*, include a way to install or update modules that are part of the system. and then scripts that depend on specific functionality would call an alias in the core to ensure required modules are installed.

*: not guaranteed

westor7 commented 6 years ago

Personally i disagree with that, my opinion is to create a seperate project about anything else that has nothing to do with JSON, i love that way you having now created.

Travis-Britz commented 6 years ago

@SReject no, mIRC doesn't have build tools - but that doesn't stop you from creating a build script for your own sanity that does simple concatenation to generate "build" versions of individual scripts. If you're compiling/minifying js scripts already then perhaps you can utilize NPM tools to do the job for you - I know a lot of them support simple copying/concatenating files together for projects that want a single CSS or JS file built from many sources.

In its simplest form, something like this could work (bash):

cat SRCore.mrc HTTP.mrc JSONForMirc.mrc > build.mrc
SReject commented 6 years ago

Overall the idea of modulerizing the code is to reduce workload, by maintaining build tools I'd be increasing it.

If you're compiling/minifying js scripts already then perhaps you can utilize NPM tools to do the job for you

This isn't viable as the JS enviornment that is used in the script is an MS implementation of ECMAScript3. NPM/Node minifiers are for ES5+ and have lead to me doing alot of the minifying by hand as the result from those tends to be incompatible with ES3.