aruZeta / QRgen

A QR code generation library.
https://aruzeta.github.io/QRgen/
MIT License
103 stars 8 forks source link

Separate modules in smaller modules #14

Closed aruZeta closed 2 years ago

aruZeta commented 2 years ago

For example: the DrawedQRCode.nim module is 438 lines long (527 after #15), having some unnecessary procedures not used out of it (except for tests) which make it a really large module.

Instead, it should be separated in other modules (under a directory by the name of the main module), each having a main section of what the main module really needs: in this case it would be the procedures used by draw(), so a module for drawFinderPatterns, drawAlignmentPatterns, etc.

There are other cases, like the qr*.nim modules which were already made like that in order to easily be imported, and would also be the case for BitArray.nim since it only implements less than a handful of procedures (and most of the lines are doc comments themselves).

- [ ] Drawing.nim - [ ] QRCode.nim

aruZeta commented 2 years ago

Also would be nice to do the same with the tests ... but that will be on another issue.

aruZeta commented 2 years ago

Change of plans, removing Drawing.nim from the list since what actually makes it so big is the print procedures, which actually make no sense having them since they are only used by DrawedQRCode so it would make more sense to have those moved there, opening an issue for that rn. (Edit: check #15)

aruZeta commented 2 years ago

Removing also QRCode.nim since it's not even 100 lines long.

aruZeta commented 2 years ago

I've encountered an issue when importing 2 modules named main.nim, where I need to use the as operator to change it's name when imported I can't seem to make work with the way I structure imports, hence I'm changing a bit the structure of these separated modules.

aruZeta commented 2 years ago

Now it all seems better organized!