-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructuring/rewriting the app #48
Comments
Nice! Will send more following PRs to contribute. |
I saw some methods are quite duplicated in different files. for example, the |
@junhan-z yes, it belongs to "provider" and should be moved there. |
"provider" can be a javascript module to fetching info from music site, It even can be used without angular, so anyone who is interested to develop tools to use those music site resource can feel free to use that module. that module loads submodules. Every submodule is one source provider, users can config to load necessary submodules to fetching music site needed. |
Sounds good! it would be good to make those module independent of this app so that the API are separated. Moreover, I also think TDD would be a good idea, especially when more people are here to contribute. It could make refactoring much easier. |
I know a little bit about TDD or unit testing. But to best of my knowledge, I am afraid that the current file structure make the test not so easy to write. The better way is to put the app into many components, each component only does one job and one job only, which promotes easier testing and mocking. Having said that, we can still write a small number of tests for major controllers/services/features/etc |
@richdho I agree with your point that we don't need to start applying TDD in a hurry, given the fact that current app works well. What we can do is, as you and the author @listen1 said, decoupling the code to modules and adding unit tests accordingly. Such tests help us make sure we won't break anything while make it easier to add and test future features. This task could be a long term goal for this project. However it should be fun and we can learn much from it. So I think let's make an initial plan and start from small parts. |
I also has little experience about TDD for complicate project. As you have seen, the app.js has too many ability and should be split into modules, but the dependencies there are complicated. So I suggest as @junhan-z , tdd can be done step by step. First, split function into different files and then fit into TDD best practice. @richdho I'm reading the TDD best practice solutions. I'm still confused about how to organize functions into their recommend structure. So I'll keep reading. And Today I read angular modules of this project and make a quick list for later use. There are several main modules: category 1: main backend module
category 2: model
category 3: view(UI) helper
category 4: Utils
|
found a simple project template for angular TDD: |
@listen1 That one is from the Angular team, it can't be wrong if we use this one. But we do have another option: https://github.com/johnpapa/generator-hottowel The author writes this style guide. Watch this video for his explanation |
Restructuring app roadmap:
|
As what I said in #43, the purpose of restructuring/rewriting the app is to bring developers/contributors a more friendly development environment. There are tons of ways of doing things in Javascript/Angular today, and here are some of my thoughts:
The quick way(add some dev tools):
The time-consuming way(rewriting, a new repo may be required)
Any suggestions are welcome.
The text was updated successfully, but these errors were encountered: