lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 137 forks source link

Feature modules #272

Closed stonelasley closed 6 years ago

stonelasley commented 6 years ago

I'd like some feedback on a motion to reorganize the project into feature-specific modules. This change doesn't make sense for the project as it stands, due to size, but if this is meant to be a seed project I think it would be helpful to provide examples.

I have a branch in progress in my fork that is more illustrative, see linked files. src/

lathonez commented 6 years ago

Can you explain the common vs clicker? A link to a blog / style guide will suffice.

I'm not convinced, will think on it. May want you to come on as a maintainer..? It's a big change and I'm pretty short on time here these days. Will get around to #270!

stonelasley commented 6 years ago

Sure. I would argue that clickers are a feature. It gets a little cloudy with the nature of this app as it's a demo but in a larger app we may have clickers, poppers, clappers and each of those would have its own components, services that may or may not be exported. Common (or perhaps shared is a better name) has any items that are shared across the app and it reexports external dependencies that will be used site wide. So Clicker, Poppers, Clappers all import CommonModule and then as we add a translate package, a pipes package etc we just import it into common and then re-export those items we want to use rather than importing each new module into each feature module. The name Common I just stole from Angular as they use this same approach. Also, I could make the argument that Page2 doesn't belong in common and may muddy the waters. It probably should exist in its own module but I couldn't come up with a meaningful name.

Application Structure: https://angular.io/guide/styleguide#application-structure-and-ngmodules https://angular.io/guide/styleguide#folders-by-feature-structure

Perhaps a better example is the largest project I work on is an app that allows business to interact with their ERP via an API. The rough feature modules are below: * most modules have models and services at minimum but I haven't written out the entire directory structure. src/

For this specific project, it's been very convenient as our modules align with licensing so we grant access per module.

stonelasley commented 6 years ago

Just want to reiterate that this isn't a PR yet for a reason, I'm looking for an interesting discussion more than anything.

stonelasley commented 6 years ago

I'm currently reading the angular2 style guide a little closer and I've already started to change my mind to some degree. I think all the modules should be under app and the common should be called Core. @lathonez if you aren't interested in reorganization I'm completely fine with that and feel free to close this.

lathonez commented 6 years ago

@stonelasley - interested in the discussion for a closed source project - possibly not re-organising clicker - I still think it would add a load of complexity for the uninitiated.

I started off here with the ng2 style guide, but haven't been back in a while, will re-read.

If anyone else watching the repo wants to give an opinion it would be very welcome.

Cheers

lathonez commented 6 years ago

Im going to close this now. I don't want to implement anything in clickers and there doesn't seem to be any discussion.